[wp-trac] [WordPress Trac] #58309: Save a few processing cycles by removing redundant is_object

WordPress Trac noreply at wordpress.org
Mon May 15 10:27:10 UTC 2023


#58309: Save a few processing cycles by removing redundant is_object
------------------------------+-----------------------------
 Reporter:  Presskopp         |       Owner:  SergeyBiryukov
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  6.3
Component:  General           |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55757" 55757]:
 {{{
 #!CommitTicketReference repository="" revision="55757"
 General: Remove a few `is_object()` checks followed by `instanceof`
 operator.

 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 [6779], [48798], [48905], [49194], [55748].

 Props Presskopp, costdev.
 Fixes #58309.
 }}}

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


More information about the wp-trac mailing list