[wp-trac] [WordPress Trac] #61451: Improve performance of block style variation registration and retrieval
WordPress Trac
noreply at wordpress.org
Wed Jun 19 23:23:41 UTC 2024
#61451: Improve performance of block style variation registration and retrieval
---------------------------------------+---------------------
Reporter: aaronrobertshaw | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.6
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: gutenberg-merge has-patch | Focuses:
---------------------------------------+---------------------
Comment (by joemcgill):
While spending time looking at possible performance implications of this
feature, I noticed that the current implementation results in a large
increase in the creation of `WP_Theme_JSON` objects, which has been known
to be a source of performance overhead in the past (see #61112).
Since [58264] the number of calls that method has increased significantly
(profiling a request to the homepage of a default site running Twenty
Twenty-Four):
- `WP_Theme_JSON::__construct` increased from 18 to 53
Additionally:
- `WP_Theme_JSON_Resolver::get_merged_data` increased from 5 to 21
- `WP_Theme_JSON_Resolver::get_theme_data` increased from 8 to 24
Some of this is probably due to the way this data is being merged into
resolved `WP_Theme_JSON` origins through the use of
`wp_theme_json_data_theme` and `wp_theme_json_data_user` filters, rather
than directly within the `WP_Theme_JSON_Resolver` class. I wonder if there
are ways we can streamline this more to avoid the need to construct so
many extra `WP_Theme_JSON` objects. Given the size of these objects, I
also am concerned that just adding caching will increase memory usage,
which can also lead to significant performance bottlenecks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61451#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list