Enhancing backslashit performance
|Reported by:||jbutkus||Owned by:||nacin|
|Severity:||normal||Keywords:||has-patch commit 3.6-early|
The backslashit function is rather frequently used, especially with date_i18n.
While preg_replace, currently used, is bullet proof, it is not of the greatest efficiency.
Here I attach a patch (based on WP 3.4.2 and patched from unit tests trunk (https://unit-tests.svn.wordpress.org/trunk).
The performance rationale: in a normal page load I get some 200 hits to date_i18n (resulting in ~0.7 seconds). The backslashit takes nearly 35 %' of it's execution time (monitored using XHProf, mmv).
After applying this patch the impact of backslashit is down to 19 percent.
It may not seem as a big gain, but 0.1 second per 1000 calls to function, which is called some 1500 times per regular page load, and may vary drastically, could be of some meaning.
Change History (12)
- Keywords commit 3.6-early added
- Milestone changed from Awaiting Review to Future Release