[wp-hackers] Cache solution for WPMU?

Ryan Boren ryan at boren.nu
Wed Sep 20 16:27:48 GMT 2006


Roland Häder wrote:
> wptexturize() is a core function. It uses a bundle of preg_replace() and str_replace() functions. When you send one text, e.g. "The lazy dog jumps over the brown fox." (or so ;-) ) it will always (!) produce the *same* result. And here my optimization comes:
> 
> When the same source text will always become the same target text why don't we cache it on disc and/or in an array? We don't need to let the interpreter do the same thing 20 times (e.g. when the script shall 20 times do wptexturize() on the same text).
> 
> I have done it here and the result is a lesser usage of preg_replace() and str_replace(). The result is a much faster execution time. :-)

Using the default theme and showing ten posts, wptexturize() is called 
less than twenty times total.  That's for the entire page.  Are your 
plugins doing all of that extra texturizing?

Ryan


More information about the wp-hackers mailing list