[php-src] PR #22087: Optimize php_spl_object_hash performance

From: Date: Tue, 19 May 2026 08:15:25 +0000
Subject: [php-src] PR #22087: Optimize php_spl_object_hash performance
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36174@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22087 Author: arshidkv12 Optimize php_spl_object_hash performance * Replace strpprintf() with manual hex conversion * Avoid printf formatting overhead * Use lookup-table-based hex encoding * Reduce runtime from ~412ms to ~244ms in benchmark * Achieve ~1.68x speed improvement ```bash hyperfine --warmup 5 \ './sapi/cli/php_old -dopcache.enable_cli=0 bench.php' \ './sapi/cli/php -dopcache.enable_cli=0 bench.php' Benchmark 1: ./sapi/cli/php_old -dopcache.enable_cli=0 bench.php ``` **Output:** ```bash Benchmark 1: ./sapi/cli/php_old -dopcache.enable_cli=0 bench.php Time (mean ± σ): 411.7 ms ± 2.3 ms [User: 407.7 ms, System: 2.8 ms] Range (min … max): 407.7 ms … 416.5 ms 10 runs Benchmark 2: ./sapi/cli/php -dopcache.enable_cli=0 bench.php Time (mean ± σ): 246.0 ms ± 1.6 ms [User: 243.0 ms, System: 2.1 ms] Range (min … max): 243.9 ms … 249.0 ms 12 runs Summary ./sapi/cli/php -dopcache.enable_cli=0 bench.php ran 1.67 ± 0.01 times faster than ./sapi/cli/php_old -dopcache.enable_cli=0 bench.php ``` ```php <?php //bench.php for ($i = 0; $i < 1000000; $i++) { spl_object_hash(new stdClass); } ```

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