In date_t() there is a call to date_t_strings(). date_t_strings() proceeds to call t() a dozen times and do manipulations on that data. t(), if locale is enabled, is not a fast function. This data should be statically cached.

In fact, it is statically cached in date_t(). Or rather, it should be. There's even a commented out static variable in there. I don't know why it's commented out.

The attached patch removes the comment to re-enable static caching. On the site I'm working on that results in a savings of about 14000 (yes, fourteen thousand) function calls and around 600 ms of execution time.

Hence the "Quick Fix, Performance, Critical." :-)

CommentFileSizeAuthor
static_replace_cache.patch1.62 KBCrell

Comments

karens’s picture

Status: Needs work » Fixed

Both of these changes got committed somewhere along the way, they are in the dev version now.

Thanks, sorry for the slow response.

Status: Fixed » Closed (fixed)
Issue tags: -Performance, -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.