[php-src] PR #14071: Avoid additional allocation in Document\createElementNS
| From: | nielsdos | Date: | Sun, 28 Apr 2024 21:51:46 +0000 |
| Subject: | [php-src] PR #14071: Avoid additional allocation in Document\createElementNS | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25922@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14071
Author: nielsdos
For the following benchmark code:
```php
$dom = DOM\XMLDocument::createEmpty();
for ($i = 0; $i < 1000*100; $i++) $dom->createElementNS("urn:a",
"thisisaveryverylongname");
```
We obtain the following on an i7-4790:
```
Benchmark 1: ./sapi/cli/php bench.php
Time (mean ± σ): 34.5 ms ± 1.2 ms [User: 31.4 ms, System: 2.9 ms]
Range (min … max): 32.4 ms … 39.3 ms 84 runs
Benchmark 2: ./sapi/cli/php_old bench.php
Time (mean ± σ): 36.6 ms ± 1.6 ms [User: 33.6 ms, System: 2.9 ms]
Range (min … max): 34.3 ms … 45.3 ms 80 runs
Summary
./sapi/cli/php bench.php ran
1.06 ± 0.06 times faster than ./sapi/cli/php_old bench.php
```