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

WordPress Trac noreply at wordpress.org
Wed May 10 18:43:47 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:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+------------------------------

Comment (by bor0):

 Thanks @davidbaumwald.


 Some more context for the second change, as the first change (`count`)
 seems straightforward.

 In case we pass an object, the performance will be better as the call to
 `is_object` will be redundant. In the other case where we pass a non-
 object, the `instanceof` operator (a variant of `is_a()`) will first
 [https://github.com/php/php-
 src/blob/f42992f/Zend/zend_builtin_functions.c#L630-L631 check if it is an
 object] before doing any further processing. Therefore, no additional
 cycles should be wasted in both cases.

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


More information about the wp-trac mailing list