Repository navigation
Commit bdeb54d
authored
Skip env resolution in Config::isEnabled() when no override is set (#131)
Every runtime check calls Config::isEnabled(), which resolved
TYPEPHP_DISABLE and TYPEPHP_ENABLED through getEnvValue() and trimmed and
filtered them on each call, even when neither is set.
Probe for the overrides first and only resolve them when one is present.
The probes still run on every call, so values that Dotenv or putenv()
set after boot keep taking effect.
PHP 8.4, 2M iterations, best of 5:
Config::isEnabled() 192 ns -> 139 ns
call with @param/@return contract 3155 ns -> 2986 ns1 parent d2bf388 commit bdeb54d
2 files changed
Lines changed: 40 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
138 | 150 | | |
139 | | - | |
140 | 151 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
145 | 157 | | |
146 | | - | |
147 | 158 | | |
148 | | - | |
149 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
150 | 162 | | |
151 | 163 | | |
152 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
316 | 332 | | |
317 | 333 | | |
318 | 334 | | |
| |||
0 commit comments