[wp-trac] [WordPress Trac] #59600: Block themes: Use a cache for block template files
WordPress Trac
noreply at wordpress.org
Mon Apr 22 16:41:20 UTC 2024
#59600: Block themes: Use a cache for block template files
--------------------------------------+--------------------------
Reporter: flixos90 | Owner: joemcgill
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.6
Component: Themes | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Comment (by thekt12):
@joemcgill I was investigating the performance opportunity in caching
`get_block_templates()`.
Down the line, this function `WP_Theme_JSON_Resolver::get_theme_data` is
the major reason for the performance regression.
At the moment, results from `get_theme_data` is static cached. So even if
we persistent cache result from `get_block_templates` we won't get any
benefit as `get_theme_data` is called inside two other functions and the
next function calling it will take the hit.
We could try to cache the `get_theme_data` output persistently instead
with a lower expiry time. So far I feel it is possible but I am
researching this as a part of
[https://core.trac.wordpress.org/ticket/57789 Trac#57789]
Another place where I found performance regression is inside
`render_block_core_template_part` which is responsible for ~20% of load
time (~110 ms). This function is one of the parents calling
`_get_block_template_file`. But `render_block_core_template_part` is lot
more dynamic and should be explored separately.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59600#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list