Replies: 1 comment 2 replies
-
Taking https://milo-college-inlined-scripts--milo-college--adobecom.hlx.live/ as the definitive place to test this... A couple thoughts:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Given the ongoing performance efforts and another performance focussed discussion - I've experimented with moving a few files into the
head.html
for themilo-college
and wanted to see what the community thinks about it.The idea
Frictionless (view-source: of link) already has a similar mechanism using edgeworkers to inline LCP assets. Given the complexity of edgeworkers - we can achieve similar gains using the
head.html
we are given from an aem product perspective. To illustrate the changes this would introduce, here's the diff for a POC in the milo-college projectLet's talk numbers!
As basis of every healthy discussion for change, we need concrete benefits. Otherwise, why spend the time & effort? For the curious here the Before and After links.
=> 2 Extra requests can be saved by inlining the consumer scripts+utils into the initial HTML. Note: Some consumers have/or want to combine their scripts+utils, that'd reduce savings to 1 request.
How "expensive" is a request?
No Throttle: 50ms x 2 => 100 MS saved 4% of the LCP Budget (2500MS)
Fast 4G: 180ms x2 => 360MS => 14.4% of the LCP Budget
Slow 4G: 600ms => 1200MS => 48% of the LCP Budget
Basis for the numbers, are consumer utils.js behind akamai. Most of that time is spent on waiting for the server response. (Size of the file is NOT the bottleneck)
Talking about size, the cc utils.js are 180 lines of code and the scripts.js are 200 lines with the styles.css sitting at 15 lines.
With 3000 lines delivered within the initial HTML (frictionless) - the requests still take more time than downloading the content
The advantages
The advantages are clear, better LCP numbers achievable with smaller changes
The disadvantages
Closing words
It might seem miniscule to save 4% or 50ms on desktop. However, 5 of those changes combined and we suddenly get 20% of our LCP budget back and can ship mobile experiences seconds faster to users, which will be great for retention, bounce rates & SEO.
One of those "5" changes, might be moving @auniverseaway experimental PR on CC to the
head.html
to instantly start loading LCP assets that we need the moment we get the initial html file back. Small incremental improvements, combine quickly...I'd love to hear what the community thinks about this.
Beta Was this translation helpful? Give feedback.
All reactions