@zachleat Coincidentally, I was adding a youtube embed "easter egg" on my 404 page this morning. Your post came at the right time! Now uses lite-youtube for those big savings 🙌 https://ryanmulligan.dev/oopsies
@zachleat As well as saving 1.1MB, I think you also avoid Google tracking your visitors before they've had a chance to decide if they want to click play or not.
@zachleat a single embed of google maps with 1 Marker is 978kb (i implemented paul Irish's library for YouTube a few weeks ago) but haven't found a similar tactic for googlemaps just yet (i checked out competitor mapbox-gl, & its 2.5mb) #webperf
But on individual photo pages, the map is a static image. At @eleventy build time, if the map image is still missing (generating them is another asynchronous process), I use Mapbox static map URLs.
@zachleat The idea that one 'youtube embed weighs 1.2 MB' reminds me of something I heard years ago. A government project required developing software going into an airplane. "What does it weight?" "Huh?" "Everything in an airplane has to specify a weight." So, they listed the weight of a floppy disk. This caused a major complaint: "You are way out of line on the price per pound ratio." Finally they explained it as "tooling costs."
@zachleat This is what always makes me laugh about how aggressive Google has been with core web vitals—it’s literally their external code that is slowing everything down. When I added a script that replaced YouTube embeds with images, that helped my CWVs a lot.
@ernie Yeah: Google is basically hundreds of different companies—most of Google’s performance advice can be viewed as though it is aimed directly at other teams at Google. I think in many cases the web performance resources were prepared with that in mind.
Notably, the solution I recommend is a web component written by a Google employee 😅
Add comment