[wp-trac] [WordPress Trac] #58458: Move the load of `array_keys` to a different level in the `WP_Hook` class

WordPress Trac noreply at wordpress.org
Mon Jun 5 15:53:38 UTC 2023


#58458: Move the load of `array_keys` to a different level in the `WP_Hook` class
-------------------------+-----------------------------
 Reporter:  bor0         |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:  has-patch
  Focuses:  performance  |
-------------------------+-----------------------------
 Since `apply_filters` is one of the most commonly called functions, it
 makes sense to not call `array_keys` every time there, rather, pre-compute
 it and use it only when needed.

 With this patch, we reduce the number of calls by at least 500 (on a basic
 WP installation) but may scale up depending on plugins, etc. Thereby,
 improving the performance, if only slightly.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58458>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list