Commit 0af87e9
committed
Improve performance of intval('+0b...', 2) and intval('0b...', 2)
For this benchmark:
```php
<?php
for ($i = 0; $i < 10000000; $i++) {
intval('+0b11111111111100000000', 2);
}
```
On an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
Time (mean ± σ): 527.3 ms ± 8.1 ms [User: 523.5 ms, System: 2.4 ms]
Range (min … max): 515.4 ms … 545.1 ms 10 runs
Benchmark 2: ./sapi/cli/php_old x.php
Time (mean ± σ): 629.3 ms ± 6.0 ms [User: 625.9 ms, System: 1.8 ms]
Range (min … max): 622.8 ms … 643.2 ms 10 runs
Summary
./sapi/cli/php x.php ran
1.19 ± 0.02 times faster than ./sapi/cli/php_old x.php
```
Closes phpGH-20357.1 parent 5ab594c commit 0af87e9
2 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
0 commit comments