[wp-trac] [WordPress Trac] #62317: Optimize "WP_Style_Engine::parse_block_styles()" by reducing unnecessary "array_merge" calls

WordPress Trac noreply at wordpress.org
Tue Oct 29 06:55:31 UTC 2024


#62317: Optimize "WP_Style_Engine::parse_block_styles()" by reducing unnecessary
"array_merge" calls
-------------------------+-------------------------
 Reporter:  mukesh27     |      Owner:  mukesh27
     Type:  enhancement  |     Status:  assigned
 Priority:  normal       |  Milestone:  6.8
Component:  Editor       |    Version:  6.1
 Severity:  normal       |   Keywords:  needs-patch
  Focuses:  performance  |
-------------------------+-------------------------
 While benchmarking WordPress 6.7, a significant number of `array_merge`
 calls were observed, particularly within the
 `WP_Style_Engine::parse_block_styles()` function in TT4 theme. The
 repeated, unnecessary calls to `array_merge` impacted performance

 This update optimizes `WP_Style_Engine::parse_block_styles()` by
 conditionally merging classnames and CSS declarations only when they are
 not empty. This removes several unwanted calls to array_merge and helps
 improve performance, especially for themes with extensive styles.

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


More information about the wp-trac mailing list