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

WordPress Trac noreply at wordpress.org
Fri Sep 23 08:56:06 UTC 2022


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

Old description:

> While running Xdebug profiling with webgring in WP-Core, I noticed that
> `realpath()` is getting called too many times and costs a lot of time.
> After some examination, I found that the `register_block_style_handle()`
> function call `realpath` to set a `$style_path_norm` variable, and then a
> few lines below that, sets a `$style_file` variable with the exact same
> value, recalculating things and re-running `realpath`.
>
> This is a simple bugfix and saves some performance. More details and
> screenshots in the PR

New description:

 While running Xdebug profiling with webgring in WP-Core, I noticed that
 `realpath()` is getting called too many times and costs a lot of time.
 After some examination, I found that the `register_block_style_handle()`
 function calls `realpath` to set a `$style_path_norm` variable, and then a
 few lines below that, sets a `$style_file` variable with the exact same
 value, recalculating things and re-running `realpath`.

 This is a simple bugfix and saves some performance. More details and
 screenshots in the PR

--

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


More information about the wp-trac mailing list