[wp-trac] [WordPress Trac] #35454: `lazyload_term_meta` is called many time when calling `get_term_metadata`

WordPress Trac noreply at wordpress.org
Sat Feb 13 03:04:10 UTC 2016


#35454: `lazyload_term_meta` is called many time when calling `get_term_metadata`
--------------------------+------------------------------
 Reporter:  sfai05        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------

Comment (by boonebgorges):

 In [changeset:"36524"]:
 {{{
 #!CommitTicketReference repository="" revision="36524"
 Improve `WP_Query` lazyloading logic, for better performance.

 Lazyloading for comment meta and term meta, introduced into `WP_Query` in
 4.4, used flags - `updated_term_meta_cache` and
 `updated_comment_meta_cache` -
 in an attempt to prevent cache priming from happening more than once per
 query
 object. This technique was mostly effective, but not entirely efficient,
 since
 the flag didn't prevent the `lazyload_*_meta` callbacks from running. The
 obvious solution - removing the filter callback after it'd be run once -
 was
 dismissed for 4.4 because of concerns that `remove_filter()` could disable
 lazyloading too generally in the context of nested queries, due to the way
 `_wp_filter_build_unique_id()` doesn't always build sufficiently unique
 IDs for
 similar objects. However, further testing shows that this concern is only
 valid
 in a very small subset of cases, while the cost of keeping the query
 objects in
 memory, via the `$wp_filter` global, is quite significant. As such, this
 changeset removes the flags in favor of the `remove_filter()` technique.

 See #35454, #35816.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35454#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list