Geek,
The large amount of CPU time seems to be spent in the regular expression searching of preg_replace().
Since 99.9% of the time, the replacement text is not present in any given post, how about pre-processing the list of replacements "text" fields to see if a simple string search using the quicker stristr() function finds the text in the post before adding it to the find/replacement array to be used by "the CPU hog" preg_replace() function? I would then expect the preg_replace() to usually only be working with a few search terms or less.
I think this would speed things up a lot when using hundreds of replacements.
|