[wp-trac] [WordPress Trac] #58528: Performance issue in register_block_style_handle

WordPress Trac noreply at wordpress.org
Tue Jun 13 12:14:08 UTC 2023


#58528: Performance issue in register_block_style_handle
--------------------------+----------------------------
 Reporter:  spacedmonkey  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  high          |  Milestone:  Future Release
Component:  Editor        |    Version:  5.8
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+----------------------------
 The function `register_block_style_handle` is extremely resource intensive
 to run. While profiling, it is noted that this function is called 184
 times on the average page load ( register styles for core blocks ). This
 function call alone can result in around 10% of server time to generate a
 page.

 This is because realpath is called. Realpath can be an expensive function
 to run. Especially if the file does not exist. In [51102], core blocks are
 register with styles, even if the files does not exist, to allow
 developers to register inline styles.

 This code should be refactored to check if file exists before running
 realpath.

 This ticket was orignally created on the gutenberg repo -
 https://github.com/WordPress/gutenberg/issues/50889

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


More information about the wp-trac mailing list