[wp-trac] [WordPress Trac] #56945: Avoid running unnecessary expensive logic around theme.json parsing for classic themes

WordPress Trac noreply at wordpress.org
Tue Nov 1 19:15:13 UTC 2022


#56945: Avoid running unnecessary expensive logic around theme.json parsing for
classic themes
-------------------------+-------------------------------------------------
 Reporter:  flixos90     |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  6.1.1
Component:  Editor       |    Version:  6.1
 Severity:  normal       |   Keywords:  has-patch 2nd-opinion needs-unit-
  Focuses:  css,         |  tests
  performance            |
-------------------------+-------------------------------------------------
 I'm opening this ticket to address the performance problem identified in
 https://core.trac.wordpress.org/ticket/56467#comment:408 (which is the
 ticket it was introduced as part of, however it's a massive ticket that
 contains 100s of changes, so it's not reasonable to discuss a specific
 change in there).
 Also see the relevant follow up comments
 https://core.trac.wordpress.org/ticket/56467#comment:411 and
 https://core.trac.wordpress.org/ticket/56467#comment:413. The performance
 problem was identified as part of a WordPress 6.1 performance analysis,
 which specifically in the `wp_head` action saw a major regression compared
 to WordPress 6.0.

 To summarize here: [54408] (also see original Gutenberg PR
 https://github.com/WordPress/gutenberg/pull/42005) has removed a condition
 that now causes `wp_add_global_styles_for_blocks()` to be called for
 classic themes as well, where prior it was only called for FSE themes.

 While this change was needed to support including certain block styles
 even for classic themes as they can be relevant there too, the logic
 triggered by `wp_add_global_styles_for_blocks()` does a lot more than
 that, most of which is only beneficial to FSE sites and thus essentially
 wasted resources for sites using a classic theme.

 A first PR with a potential fix is available in
 https://github.com/WordPress/wordpress-develop/pull/3536, and it
 **improves median `wp_head` execution time from 16.45ms to 11.92ms (~28%
 faster)**.

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


More information about the wp-trac mailing list