[wp-trac] [WordPress Trac] #57789: Make theme.json related caches persistent

WordPress Trac noreply at wordpress.org
Thu Aug 17 22:19:21 UTC 2023


#57789: Make theme.json related caches persistent
-----------------------------------------+---------------------------
 Reporter:  flixos90                     |       Owner:  spacedmonkey
     Type:  enhancement                  |      Status:  assigned
 Priority:  normal                       |   Milestone:  6.4
Component:  Themes                       |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  needs-patch gutenberg-merge  |     Focuses:  performance
-----------------------------------------+---------------------------
Changes (by joemcgill):

 * keywords:  gutenberg-merge has-patch => needs-patch gutenberg-merge


Comment:

 After spending some time getting a better understanding of this system,
 and reading through the history of this issue, It seems to me like we
 should be focusing on a strategy for persistently caching data from
 `WP_Theme_JSON_Resolver`.

 Currently, this class is responsible for loading theme.json data from four
 different sources (core, blocks, theme, and editor data) and then merging
 them together (depending on context).

 All of the individual sources only get calculated once and stored to a
 static property of that class, which helps, but the process of creating a
 merged `WP_Theme_JSON` object is still pretty expensive.

 I'd like to explore three options:

 1. Store the merged data to a static property, similar to the individual
 sources, to eliminate the cost of merging them.
 2. Make the entire merged result cacheable in a persistent way
 3. Make the data from each source cacheable in a persistent way, if the
 entire result cannot be cached persistently

 Option 1, seems like a very simple optimization with very little downside.
 I've opened [https://github.com/WordPress/wordpress-develop/pull/5024 a
 PR] as a proof of concept.

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


More information about the wp-trac mailing list