[wp-trac] [WordPress Trac] #2978: remove_accents is a hog

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 26 22:46:10 GMT 2006


#2978: remove_accents is a hog
--------------------------+-------------------------------------------------
 Reporter:  skeltoac      |       Owner:  anonymous
     Type:  defect        |      Status:  new      
 Priority:  normal        |   Milestone:  2.0.4    
Component:  Optimization  |     Version:  2.0.3    
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 Profiling a page load with 61 remove_accents calls (sanitize_title does
 this) found that remove_accents was taking 86ms, or >1ms per call.

 I added this to remove_accents as a first line:
 {{{
 if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
 }}}

 This reduced the total execution time to 1.8ms, or 0.03ms per call. Nice
 savings.

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


More information about the wp-trac mailing list