[wp-trac] [WordPress Trac] #37114: Allow short-circuiting `get_post_class` for performance
WordPress Trac
noreply at wordpress.org
Thu Aug 30 22:17:19 UTC 2018
#37114: Allow short-circuiting `get_post_class` for performance
-------------------------------------------------+-------------------------
Reporter: bordoni | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Posts, Post Types | Version: 4.2
Severity: normal | Resolution:
Keywords: has-patch dev-feedback needs- | Focuses: template,
testing | performance
-------------------------------------------------+-------------------------
Comment (by boonebgorges):
> However, the tradeoff with the snippet above is the number of queries
increases exponentially. In my testing, the current behavior is actually
much faster than using the code snippet above, but I do not have any
caching enabled. With something like Memcached enabled, it may help
prevent running all of those queries at once.
On my setup, disabling post-term cache priming has dramatically *negative*
performance effects, and this is without any persistent caching. So I
think that the situation depends heavily on the specifics of the
situation. On my setup, I can mitigate the performance issue by forcing
`update_object_term_cache()` inside of `get_post_class()` even when post
term caching has been disabled at the `WP_Query` level, but seems like a
bad solution as well.
Aside from simply rolling back [31271], I can't think of a good all-
purpose fix for the problem. So the filter suggested in
[attachment:"37114.2.diff"] seems as good a solution as any.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37114#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list