[wp-trac] [WordPress Trac] #57648: Major performance regression in `wp_enqueue_global_styles()` for classic themes

WordPress Trac noreply at wordpress.org
Wed Feb 8 20:01:08 UTC 2023


#57648: Major performance regression in `wp_enqueue_global_styles()` for classic
themes
--------------------------+--------------------------
 Reporter:  flixos90      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  6.2
Component:  Editor        |     Version:  trunk
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+--------------------------

Comment (by flixos90):

 Replying to [comment:7 oandregal]:
 > @flixos90 I'm still at a loss as to how measure the `wp-*` metrics 😅
 I've used the server-timing script before but I'd need to know ''where''
 do you measure `wp-total`, `wp-template`, etc. for me to replicate.

 Sorry about that, I still forgot to explain those specific metrics in my
 last comment. Hopefully I can clear things up here.

 All metrics that I initially measured (`wp-before-template`, `wp-template`
 etc.) are based on the [https://wordpress.org/plugins/performance-lab/
 Performance Lab plugin]'s Server-Timing API implementation. See
 https://github.com/WordPress/performance/pull/553, the PR description
 mentions what these metrics are.
 * `wp-before-template` is essentially the time from WordPress's
 `timer_start()` call until the very end of the `template_redirect` action.
 * `wp-template` is the time after that, i.e. from the very end of the
 `template_redirect` action until the `shutdown` action.
 * The respective `*-db-queries` is the time the subset of that time that
 was consumed by database queries.
 * `wp-total` is simply the sum of `wp-before-template` plus `wp-template`.

 If you activate the [https://wordpress.org/plugins/performance-lab/
 Performance Lab plugin], you'll get these Server-Timing metrics out of the
 box (except `wp-total`, but you can simply use the sum of the two other
 metrics it is comprised of per the above). (Make sure you deactivate all
 Performance Lab plugin modules under "Settings > Performance", since you
 don't want those to run when just testing core performance.)

 You can use the Server-Timing API in the Performance Lab plugin to
 register your own metrics, e.g. in any specific function or action.
 [https://gist.github.com/felixarntz/43fb19e6491a1bc65a7e930dace17c47 This
 Gist] has some example usages. You can also wrap hook callbacks with a
 convenience function `perflab_wrap_server_timing()` (see the above PR
 description for an example of that). I used the approach from that Gist
 for example to then test more specifically the timing of `wp_head` and
 `wp_enqueue_scripts`.

 The [https://gist.github.com/felixarntz/de5c697a1a16c2b892634b70216eb6c7
 other Gist] that I shared in
 https://core.trac.wordpress.org/ticket/57648?replyto=7#comment:5 is simply
 a very lightweight version of what the Performance Lab plugin's Server-
 Timing feature provides a proper API for. So either can be used to get the
 same data.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57648#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list