[wp-hackers] [PATCH] Improve performance of convert_smilies by *10
sewpafly at gmail.com
Mon Jan 5 20:08:38 GMT 2009
> 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.
I have never tested for myself to find if this makes much of a
difference, but I found this in the php documentation for
preg_replace... If you're trying to wring the biggest performance
gain in the patch, perhaps this would help?
"Note that it is in most cases much more efficient to use
preg_replace_callback(), with a named function or an anonymous
function created with create_function(), instead of the /e modifier.
When preg_replace() is called with the /e modifier, the interpreter
must parse the replacement string into PHP code once for every
replacement made, while preg_replace_callback() uses a function that
only needs to be parsed once."
More information about the wp-hackers