[wp-trac] [WordPress Trac] #58931: Use defer loading strategy for wp-embed script and move to head in block themes

WordPress Trac noreply at wordpress.org
Fri Jul 28 23:54:19 UTC 2023


#58931: Use defer loading strategy for wp-embed script and move to head in block
themes
-------------------------+--------------------------
 Reporter:  westonruter  |       Owner:  westonruter
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  6.4
Component:  Embeds       |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+--------------------------

Comment (by westonruter):

 I made 100 requests using [https://github.com/GoogleChromeLabs/wpp-
 research/tree/main/cli#benchmark-web-vitals benchmark-web-vitals], both
 before and after the change. I tested on the wordpress-develop development
 environment on a post that had a single post embed from Make/Core and
 comments open. Here is the median impact to LCP-TTFB that I observed:

 Before: '''49.45 ms'''
 After: '''50.85 ms'''

 Surprisingly, it actually ''increased'' LCP by 1.4 ms. Nevertheless, since
 I'm testing on my local machine when there is no network latency, this may
 be the cause. If there are network constraints it stands to reason that it
 would take more of a percentage of the loading time, and then `defer`
 would help.

 This was with the post embed appearing in the first viewport, however. The
 network variability of loading the post embed may be to blame.

 If I modify the post to add various paragraphs above the post embed so
 that it is pushed out of the initial viewport, the LCP-TTFB results are as
 follows:

 Before: '''54.2 ms'''
 After: '''52.95 ms'''

 Here the LCP ''decreased'' by 1.25 ms.

 All in all, the impact of this change seems like it will be marginal in
 either direction.

 Lastly, I did try modifying the benchmark-web-vitals command to
 [https://pptr.dev/api/puppeteer.page.emulatenetworkconditions
 emulateNetworkConditions] for Slow 3G, still with the post embed outside
 the viewport. Over 25 requests, the median LCP-TTFB I observed:

 Before: '''3043.3 ms'''
 After: '''3041.3 ms'''

 So again, the difference is a ''miniscule'' '''2 ms'''.

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


More information about the wp-trac mailing list