[php-src] PR #16376: Dom optimized serialize html

From: Date: Fri, 11 Oct 2024 19:19:01 +0000
Subject: [php-src] PR #16376: Dom optimized serialize html
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-29167@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/16376 Author: nielsdos This patch adds a fast path to the HTML serialization encoding that has to encode to UTF-8. Because the DOM internally represents all strings using UTF-8, we only need to validate here. Tested on Wikipedia English home page on an i7-4790: ``` Benchmark 1: ./sapi/cli/php x.php Time (mean ± σ): 516.0 ms ± 6.4 ms [User: 511.2 ms, System: 3.5 ms] Range (min … max): 506.0 ms … 527.1 ms 10 runs Benchmark 2: ./sapi/cli/php_old x.php Time (mean ± σ): 682.8 ms ± 6.5 ms [User: 676.8 ms, System: 3.8 ms] Range (min … max): 675.8 ms … 695.6 ms 10 runs Summary ./sapi/cli/php x.php ran 1.32 ± 0.02 times faster than ./sapi/cli/php_old x.php ``` (And if you're interested: it takes over a second on my machine using the old DOMDocument class) Future optimizations are certainly possible, but let's start here.

« previous php.git-pulls (#29167) next »