[wp-trac] [WordPress Trac] #59115: Use defer loading strategy for block view scripts

WordPress Trac noreply at wordpress.org
Wed Aug 16 00:09:46 UTC 2023


#59115: Use defer loading strategy for block view scripts
--------------------------+--------------------------------------
 Reporter:  westonruter   |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  6.4
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript, performance
--------------------------+--------------------------------------
Changes (by westonruter):

 * owner:  (none) => westonruter
 * status:  new => accepted


Comment:

 I tested the performance of this change, over 100 page loads before/after
 using [https://github.com/GoogleChromeLabs/wpp-research/tree/main/cli
 #benchmark-web-vitals benchmark-web-vitals]:

 {{{
 npm run research -- benchmark-web-vitals -u
 http://localhost:8889/2023/08/15/pdf-embed/ -n 100 -o csv
 }}}

 I did this on wordpress-develop with `SCRIPT_DEBUG` disabled and the
 Twenty Twenty-Three theme active. I added the Search block to the header,
 configured to be button only so that its JS file is added to the page. I
 also configured the Navigation block with dropdowns and responsive menu so
 that is JS also is included. Lastly, I added a file block with an embedded
 PDF so that its view JS file is included. The median results for LCP-TTFB:

 ||= Before =||= After =||= Diff (ms) =||= Diff (%) =||
 || 50.5 || 47.2 ||      -3.3    || -6.53%

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


More information about the wp-trac mailing list