[wp-trac] [WordPress Trac] #22286: Enhancing backslashit performance

WordPress Trac noreply at wordpress.org
Fri Oct 26 14:24:21 UTC 2012


#22286: Enhancing backslashit performance
-----------------------------+-------------------------
 Reporter:  jbutkus          |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Formatting
  Version:                   |   Severity:  normal
 Keywords:  has-patch        |
-----------------------------+-------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22286>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list