[wp-trac] [WordPress Trac] #59181: Performance optimization of register_block_script_handle()

WordPress Trac noreply at wordpress.org
Thu Aug 24 09:47:41 UTC 2023


#59181: Performance optimization of register_block_script_handle()
-------------------------+-------------------------------------------------
 Reporter:  mukesh27     |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Editor       |    Version:  5.5
 Severity:  normal       |   Keywords:  needs-patch has-screenshots good-
  Focuses:               |  first-bug
-------------------------+-------------------------------------------------
 During profiling for TT3 home page, a performance bottleneck has been
 identified within the `register_block_type_from_metadata` function of the
 WordPress core. This function is responsible for a significant portion
 (approximately 8-10%) of the overall load time. Subsequent analysis
 reveals that the `register_block_script_handle` function, called within
 `register_block_type_from_metadata`, contributes to about 3% of the load
 time. Given these findings, there's a clear opportunity to enhance the
 performance of these functions.


 Within the `register_block_type_from_metadata` function, the
 `register_block_script_handle` function is being invoked four times. This
 is a significant contributor to the overall load time. Further examination
 of the code shows that the [https://github.com/WordPress/wordpress-
 develop/blob/trunk/src/wp-includes/blocks.php#L157 plugins_url function]
 is also called within this context. However, it appears that this call to
 "plugins_url" is relevant only for theme blocks.

 Check attached screenshots for more details.

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


More information about the wp-trac mailing list