#58457 closed enhancement (fixed)
Optimize `WP_Theme_JSON::append_to_selector`
Reported by: | bor0 | Owned by: | |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 6.3 |
Component: | Editor | Keywords: | has-patch |
Focuses: | performance | Cc: |
Description
On a basic WordPress installation, visiting the frontend page shows about 1104 calls to the function WP_Theme_JSON::append_to_selector
.
We find a way to optimize the function by bringing the conditional check one level above. While it increases code verbosity, it also improves performance, as can be seen by the attached images.
Attachments (4)
Change History (13)
#3
@
16 months ago
This change will need to made in Gutenberg and ported back to core.
See this PR that have already been merged into Gutenberg
https://github.com/WordPress/gutenberg/pull/47833
https://github.com/WordPress/gutenberg/pull/50266
These will be backported as part of the WP 6.3 release.
#4
@
15 months ago
@bor0 Can you rebase your PR now that [55907] is committed. I think performance issue is fixed, but worth another look. Thanks!
#6
@
15 months ago
@bor0 Thanks for opening this ticket, I hadn't seen it until now. Note that my PR https://github.com/WordPress/wordpress-develop/pull/4380 optimizes the logic around append_to_selector()
in a way that no conditions will be needed anymore at all. So if we commit that, we can probably close this ticket here as well.
Also see #58193.
Performance measurements of the current function