[php-src] Issue #12873: Function `zend_hash_find_bucket` consumes much time in WordPress workload
| From: | PeterYang12 | 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.

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.

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_