[php-src] Issue #12873: Function `zend_hash_find_bucket` consumes much time in WordPress workload

From: Date: Tue, 05 Dec 2023 10:37:24 +0000
Subject: [php-src] Issue #12873: Function `zend_hash_find_bucket` consumes much time in WordPress workload
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245986@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12873 Author: PeterYang12 ### Description Dear, maintainers: I am utilizing PHP-FPM and have profiled performance data for a WordPress workload. Within this benchmark, I've identified certain hotspots. The performance analysis from 'perf' highlights that functions such as zend_hash_find and zend_hash_find_known_hash are consuming a considerable amount of time. Upon investigation, I suspect that the core issue lies within the zend_hash_find_bucket function. ![image](https://github.com/php/php-src/assets/87349553/0a5d0d40-6e32-4ecc-9c8a-9dce8011cab2) Upon inspecting the assembly code and annotating it, I noticed that certain 'mov' instructions are causing significant delays. To address this, I attempted to optimize the zend_hash_find_bucket function. I experimented with optimizations such as utilizing prefetch instructions and employing struct alignment. However, these optimizations did not seem to have a discernible impact on performance. ![image](https://github.com/php/php-src/assets/87349553/0fdca290-fbba-4b01-9ed2-3794c8e2e4d7) Is this a known performance issue within the PHP community? I'm seeking suggestions or insights on potential avenues for optimization. Your feedback and suggestions would be greatly appreciated. ### PHP Version master ### Operating System _No response_

« previous php.bugs (#245986) next »