[php-src] PR #13702: HTML5 parser optimizations
| From: | nielsdos | Date: | Wed, 13 Mar 2024 20:38:24 +0000 |
| Subject: | [php-src] PR #13702: HTML5 parser optimizations | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25407@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13702
Author: nielsdos
A patch series to optimize HTML5 parsing. See individual commits.
Tested on English Wikipedia homepage.
Test code:
```php
<?php
$contents = file_get_contents('wiki.html');
for ($i=0;$i<500;$i++)
$dom = @DOM\HTMLDocument::createFromString($contents);
```
```
Benchmark 1: ./sapi/cli/php test.php
Time (mean ± σ): 779.4 ms ± 4.9 ms [User: 774.0 ms, System: 4.0 ms]
Range (min … max): 772.7 ms … 791.3 ms 10 runs
Benchmark 2: ./sapi/cli/php_old test.php
Time (mean ± σ): 859.0 ms ± 8.5 ms [User: 854.2 ms, System: 3.4 ms]
Range (min … max): 852.1 ms … 878.7 ms 10 runs
Summary
./sapi/cli/php test.php ran
1.10 ± 0.01 times faster than ./sapi/cli/php_old test.php
```