diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2019-11-13 01:12:49 -0500 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-11-15 17:37:01 +0300 |
commit | e8525c2f68d938162af055fd843239778a13565d (patch) | |
tree | ee3b1f8b08ee080bbfa594270e31fb33b269e87c /sapi/apache2handler/php_functions.c | |
parent | 17a021e2289710ccad7b7169ec00614e148026cd (diff) | |
download | php-git-e8525c2f68d938162af055fd843239778a13565d.tar.gz |
Optimize int === int/double === double
Do this by reusing the implementation used for `==`
when both arguments are ints (IS_LONG) or both are floats (IS_DOUBLE)
```php
// Before: nestedloop_ni took 0.442 seconds
// After: nestedloop_ni takes 0.401 seconds (same as nestedloop_ne)
function nestedloop_ni(int $k) {
$x = 0;
for ($i=0; $i < 50000000; $i++) {
if ($i === $k) {
$x++;
}
}
print "$x\n";
}
function nestedloop_ne(int $k) {
$x = 0;
for ($i=0; $i < 50000000; $i++) {
if ($i == $k) {
$x++;
}
}
print "$x\n";
}
```
Diffstat (limited to 'sapi/apache2handler/php_functions.c')
0 files changed, 0 insertions, 0 deletions