[wp-trac] [WordPress Trac] #56758: Performance: Avoid extra calls to realpath

WordPress Trac noreply at wordpress.org
Fri Oct 7 13:34:21 UTC 2022


#56758: Performance: Avoid extra calls to realpath
--------------------------+--------------------
 Reporter:  aristath      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  6.1
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+--------------------
 The `register_block_style_handle` function sets a variable with this code:
 `$wpinc_path_norm = wp_normalize_path( realpath( ABSPATH . WPINC ) );`
 That value never changes, so we can convert that var to be a static
 variable. By doing so, we can avoid ~200 calls to `realpath` and
 `wp_normalize_path` (more if 3rd-party plugins register styles)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56758>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list