[wp-trac] [WordPress Trac] #55005: Improve PHP performance for block.json files

WordPress Trac noreply at wordpress.org
Thu Sep 8 10:13:32 UTC 2022


#55005: Improve PHP performance for block.json files
-------------------------------------------------+-------------------------
 Reporter:  aristath                             |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.1
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------

Comment (by aristath):

 > Hey @hellofromTonya & @aristath - this ticket came up in the performance
 bug scrub today and I wanted to check on the prospects of landing this in
 6.1, what do you think?

 Landing this in 6.1 would be the desired outcome.
 This patch doesn't break backwards-compatibility in any way, and simply
 improves PHP performance for Core blocks by preventing 70+ file-reads and
 json-decoding calls.


 > Reviewing the ticket and PR it looks like this left off needing more
 solid testing around the performance benefits.

 There's no argument that this does indeed improve performance. In my tests
 the performance gain was ~33%, but that's anecdotal and I'm guessing it
 would range between 10-40% depending on the environment. Still... far from
 negligible.

 > In addition, @johnbillion asked about cache invalidation, is that
 covered in this ticket?

 There is no database cache, so nothing to invalidate. The "cache" here is
 a compiled PHP file, generated from the `block.json` files. If a
 `block.json` file changes, then we'd have to run `npm run build` to update
 the JS files anyway, and when doing that the PHP file gets recompiled at
 the same time so I don't think that cache-invalidation is of any concern
 here 👍

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


More information about the wp-trac mailing list