[wp-trac] [WordPress Trac] #58290: Save a few processing cycles in `WP_Hook`

WordPress Trac noreply at wordpress.org
Wed May 10 18:45:24 UTC 2023


#58290: Save a few processing cycles in `WP_Hook`
-----------------------------------+------------------------------
 Reporter:  bor0                   |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Plugins                |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  performance
-----------------------------------+------------------------------
Changes (by johnbillion):

 * keywords:  has-patch => has-patch 2nd-opinion
 * version:  trunk =>
 * milestone:  6.3 => Awaiting Review


Comment:

 Thanks for the patch @bor0. Removing the `is_object()` call makes sense.

 The change to the `count( $args )` call could actually increase the number
 of times it gets counted. Currently the count happens exactly once for
 every call to `apply_filters()`. With this change in place the number of
 times the count happens is equal to the number of callbacks attached to
 the filter where `accepted_args` is greater than or equal to the number of
 arguments passed to the filter. Worth some more thought.

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


More information about the wp-trac mailing list