[wp-trac] [WordPress Trac] #59600: Block themes: Use a cache for block templates and block template parts content

WordPress Trac noreply at wordpress.org
Wed Oct 11 18:21:15 UTC 2023


#59600: Block themes: Use a cache for block templates and block template parts
content
--------------------------+----------------------
 Reporter:  flixos90      |      Owner:  flixos90
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  6.4
Component:  Themes        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+----------------------
 While reviewing the performance impact of #59583, I noticed that a large
 chunk of the cost of parsing block templates and block template parts
 comes from simply the `file_get_contents()` calls for those files.

 On every page load for a block theme, several block templates and template
 parts are used, each of which results in a `file_get_contents()`
 operation. Getting these file contents is an expensive operation, that
 results in a performance bottleneck which gets greater the more block
 template parts are being used in a theme.

 I have prepared a draft PR with a solution for this and based on Server-
 Timing benchmarks, it notably improves the overall response time by a
 solid 5-10% for various block themes.

 Given this is a major performance win and relies on a pattern already
 established via #59490 / [56765], I think it is worth prioritizing even
 this late in the release cycle.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59600>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list