[php-src] PR #18157: Improve performance of array_find() etc
| From: | nielsdos | Date: | Wed, 26 Mar 2025 22:23:53 +0000 |
| Subject: | [php-src] PR #18157: Improve performance of array_find() etc | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31185@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18157
Author: nielsdos
This avoids destruction logic for the common case, avoids some copy, and adds an optimization hint.
On an intel i7 1185G7:
```
Benchmark 1: ./sapi/cli/php x.php
Time (mean ± σ): 543.7 ms ± 3.8 ms [User: 538.9 ms, System: 4.4 ms]
Range (min … max): 538.4 ms … 552.9 ms 10 runs
Benchmark 2: ./sapi/cli/php_old x.php
Time (mean ± σ): 583.0 ms ± 4.2 ms [User: 578.4 ms, System: 3.4 ms]
Range (min … max): 579.3 ms … 593.9 ms 10 runs
Summary
./sapi/cli/php x.php ran
1.07 ± 0.01 times faster than ./sapi/cli/php_old x.php
```
On an intel i7 4790:
```
Benchmark 1: ./sapi/cli/php x.php
Time (mean ± σ): 828.6 ms ± 4.8 ms [User: 824.4 ms, System: 1.6 ms]
Range (min … max): 822.8 ms … 839.0 ms 10 runs
Benchmark 2: ./sapi/cli/php_old x.php
Time (mean ± σ): 940.1 ms ± 26.4 ms [User: 934.4 ms, System: 2.5 ms]
Range (min … max): 918.0 ms … 981.1 ms 10 runs
Summary
./sapi/cli/php x.php ran
1.13 ± 0.03 times faster than ./sapi/cli/php_old x.php
```