[wp-trac] [WordPress Trac] #57814: Use `wp_theme_has_theme_json` in `_wp_theme_json_webfonts_handler`
WordPress Trac
noreply at wordpress.org
Fri Mar 10 22:16:14 UTC 2023
#57814: Use `wp_theme_has_theme_json` in `_wp_theme_json_webfonts_handler`
---------------------------+------------------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 6.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
---------------------------+------------------------------
Comment (by flixos90):
@spacedmonkey @hellofromTonya I have conducted a performance benchmark for
https://github.com/WordPress/wordpress-develop/pull/4185 in
[https://docs.google.com/spreadsheets/d/1Oe-6ZO_Jqt6qSp2yF-
ohb05McEB2y22aqU0S7gXuyGs/edit this spreadsheet]. I did two comparisons,
with 250 runs each. For the first one I manually calculated the total load
time from the two other metrics, which however is not entirely correct
statistically, so then I also ran a second check where each of the runs
had its own total load time.
Summary of the results:
* The fix here speeds up the time WordPress takes to bootstrap, before it
starts template output **between 11-16% at the median**. The faster
bootstrap time is expected, since by adding the extra condition here the
logic in `_wp_theme_json_webfonts_handler()` is not run, which is hooked
into `plugins_loaded`, i.e. runs very early.
* At the same time, the fix slows down the time WordPress takes to render
the template **between 9-16% at the median**. This needs more
investigation. I was first thinking that it might make sense because of
the `theme.json` parsing happening later now, but on second thought I
wonder why that is happening ''additionally''. There may be something else
that is normally calculated in here and now due to bailing in the logic
still happens later.
* The total load time sees an **improvement of ~1%** at the moment based
on the statistically correct `wp-total` median.
It is safe to say that this very small change can have wide performance
implications, so I think we should continue to explore it. The fact that
this is a private function that hopefully gets removed in 6.3 doesn't mean
we cannot enhance it, particularly if there is a real performance impact
to be made.
That said, right now the partial regression for the template rendering
time means we need to figure out what is happening there and why. If we
can do that and solve the remaining problem, this ticket has the potential
to be a significant performance enhancement.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57814#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list