-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweak to fix performance of calling tailor_get_terms() #120
base: master
Are you sure you want to change the base?
Tweak to fix performance of calling tailor_get_terms() #120
Conversation
…nt. Instead call it once on registration and cache the result in static variables
I'd closed this PR as I hadn't originally intended to make it public, only to share with my colleagues. However, we're now using this change internally to fix the performance issue when you have a large number of terms (10,000s in our case). I'm not a Wordpress developer so I'm not sure how "Wordpressy" the fix is, but the notion of caching early in the process rather than reading each term for each element seems sound. Would be great to hear your thoughts :) |
Thanks, @codeeverything. I wonder whether WordPress transients would be a better approach to solving this problem; have you considered those? If not, I can investigate further. |
@andrew-worsfold Thanks for the reply :) Not sure about transients - after a quick read up it seems like these would persist across requests. That would lighten the load, but IMHO I think each request should be served on it's own merits, so I'd go with I also have a couple of other problem areas I'm looking at (similar caching solution), which I may push into this PR or add as new ones. Just got to find some time to look more properly this week. These few performance issues aside - nice plugin :) |
@andrew-worsfold As discussed I've rewritten my original change to use Wordpress's object cache rather than rely on class static variables. This doesn't perform quite as well (more logic overhead), but it's probably a safer bet. I've also included two other performance fixes in the same vein. The The |
@andrew-worsfold As a final note - the above changes leave us with around a 30% penalty when enabling Tailor, a better result but would be nice if it was less :) I think we're starting to hit diminishing returns, but I had one last thought. It looks as though Tailor elements are registered and call |
Tweak to fix performance when large numbers of categories/tags exist, and/or large numbers of elements are used on a Tailored page.
tailor_modify_colorpicker
to reduce calls toget_theme_mod()
$control_definitions
intailor_control_presets()
to keep calls to__()
sky-rocketing