[wp-trac] [WordPress Trac] #58290: Save a few processing cycles in `WP_Hook`
WordPress Trac
noreply at wordpress.org
Thu May 11 11:42:16 UTC 2023
#58290: Save a few processing cycles in `WP_Hook`
-----------------------------------+-----------------------------
Reporter: bor0 | Owner: SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.3
Component: Plugins | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch 2nd-opinion | Focuses: performance
-----------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"55748" 55748]:
{{{
#!CommitTicketReference repository="" revision="55748"
Plugins: Remove `is_object()` check in
`WP_Hook:build_preinitialized_hooks()`.
This is a minor performance enhancement:
* If an object is passed, the call to `is_object()` will be redundant.
* If a non-object is passed, 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 processing cycles should be wasted in both cases.
Follow-up to [38571].
Props bor0, johnbillion, davidbaumwald.
Fixes #58290.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58290#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list