[wp-hackers] [PATCH] Improve performance of convert_smilies by *10

mrmist listswphackers at mist.org.uk
Mon Jan 5 20:06:38 GMT 2009


In message 
<7547287e0901051155x754dcf7dub9cd193f553aa3ee at mail.gmail.com>, Johan 
Eenfeldt <johan.eenfeldt at gmail.com> writes
>Hi,
>
>When profiling filter performance I found that the single most
>expensive one was convert_smilies (can be 30+% of total page
>construction time on post with many comments).
>
>This patch changes smilies_init to make a more efficient regular
>expression resulting in a *10 speedup.
>
>This is done by:
>o the search expression is built up as sub-expressions for smiley
>first letter (example of partial result: "8(\)|-\)|-O|O)").
>o to handle the replacement it uses the 'e' modifier at end of search
>string which makes preg_replace() treat the replacement parameter as
>PHP code after reference substitution is done.
>
Nice idea, but see http://trac.wordpress.org/ticket/8689
-- 
mrmist


More information about the wp-hackers mailing list