[wp-trac] [WordPress Trac] #56636: Bug/performance: duplicate use of realpath()

WordPress Trac noreply at wordpress.org
Fri Sep 23 13:24:38 UTC 2022


#56636: Bug/performance: duplicate use of realpath()
--------------------------+-----------------------------
 Reporter:  aristath      |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  6.1
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+-----------------------------
Changes (by SergeyBiryukov):

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


Comment:

 In [changeset:"54290" 54290]:
 {{{
 #!CommitTicketReference repository="" revision="54290"
 Blocks: Remove duplicate use of `realpath()` in
 `register_block_style_handle()`.

 The `register_block_style_handle()` function called `realpath()` when
 retrieving the normalized style path, and then a few lines below that,
 recalculated the exact same value, running `realpath()` again.

 This commit removes duplicate calculations, reducing the number of
 `realpath()` calls in the function by half. In tests ran using Xdebug &
 Webgrind, the total `realpath()` invocation count goes down from 639 to
 461, and total self cost (the time that the function is responsible for)
 goes down from 146 ms to 89 ms.

 Follow-up to [48141], [52291], [53091], [54155].

 Props aristath.
 Fixes #56636.
 }}}

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


More information about the wp-trac mailing list