Namastē Smashing Friends,
Sometimes it might feel like we have it all figured out. With Core Web Vitals, we’ve learned the important metrics to optimize for, and have also discovered strategies on how to optimize our code base for performance. Of course, green scores aren’t easy to achieve, but there are some useful ideas of how to get there. Yet there are plenty more things to explore: from priority hints to back/forward cache.
In this newsletter, we look at some of the uncharted territories of web performance. From priority hints and third parties to speculative prerendering, preload scanner and dealing with LCP, we hope that you’ll find some useful gems in here. Happy optimizing!
In our Smashing news, we have a new free workshop Crash Course on Jamstack with Next.js and Storyblok coming up this Wednesday, kindly powered by Storyblok, who is equally great in headless CMS and in being a kind friend of Smashing over the years. We hope to see you there!
And of course, we have a few SmashingConfs coming up later this year, and there are plenty of online workshops and a video course to take a look at as well. Lots of stuff is happening, and we have some exciting updates coming up soon, this time around for our printed stuff! In the meantime, stay tuned, and take good care of yourself and of your family!
— Vitaly (@smashingmag)
1. Priority Hints And Early Hints
Loading critical assets as fast as possible is vital for improving web performance and user experience. And while browsers can make educated guesses about which assets are critical, each site and application is different in setup and context. Priority Hints are here to give you more control over asset prioritization — to signal high-priority images, priority of asynchronous scripts, or priority of Fetch API calls, for example. Karolina Szczur explains when to use Priority Hints and how to implement them.
But what about server latency that delays rendering of a page? With websites having become more sophisticated over time, it’s not unusual that a server needs to perform non-trivial work to produce the HTML for the requested page — to access databases or CDNs accessing the origin server, for example. Well, as it turns out, we can employ this latency to our advantage.
The Chrome team recently presented a solution to make use of this “server think-time”: Early Hints. To speed up page loads, the browser can use those hints to do some work in advance, such as warming up connections and requesting sub-resources while waiting for the main resources. Kenji Baheux summarized everything you need to know about Early Hints. (cm)
2. Don’t Fight The Preload Scanner
Apart from all the performance optimization techniques and strategies, there’s an aspect often overlooked when we talk about optimizing page speed: browsers. Browsers make certain optimizations to improve performance that developers can’t. Jeremy Wagner takes a closer look at one of them: the browser preload scanner.
In his post “Don’t fight the browser preload scanner”, Jeremy explores how the preload scanner works and, more importantly, how you can avoid getting in its way. To help your pages load faster, the preload scanner scans raw markup to find resources to opportunistically fetch before the primary HTML parser would otherwise discover them. As Jeremy points out, harmful practices that can defeat the scanner include injecting resources into the DOM with JavaScript, lazy-loading above-the-fold images or iframes using a JavaScript solution, or rendering markup on the client that may contain references to document sub-resources using JavaScript. Good to know! (cm)
3. Dealing With Third-Party Scripts
Third-party scripts are everywhere. They deliver JavaScript framework libraries, custom fonts, advertising content, analytics trackers, and more. And, well, your website may be using more third-party services than you may realize. But how do you quantify the impact that third-party requests have on your site’s performance? And how do you manage and mitigate that impact? In his article, “Don’t Sink your Website With Third Parties”, Ken Harker explains what third-party scripts really are and which optimization strategies can help reduce their impact on the user experience.
Another solution to eliminate website bloat caused by third parties is Partytown. Partytown is a lightweight, open-source solution that offloads third-party scripts to web workers which run in background threads to reduce execution delays. Steve Sewell wrote a great introduction to Partytown. Speaking of third-party scripts: If you want to get a better idea of how big a script’s impact is compared to others, 3Pweb will come in handy. The tool visualizes and compares the average cost, total impact, and popularity of common third parties. (cm)
4. Upcoming Online Workshops
You might have heard it: we run online workshops around frontend and design, be it accessibility, performance, navigation, or landing pages. In fact, we have a couple of workshops coming up soon, and we thought that, you know, you might want to join in as well.
With online workshops, we aim to give you the same experience and access to experts as in an in-person workshop from wherever you are.
As always, here’s an overview of our upcoming workshops:
5. Speculative Prerendering
To cater for a speedier user experience, resource hints help the browser figure out which resources the user will need in the near future. And while preconnect
and preload
are perfect for resources that will be required during the next load, prefetch
and prerender
are speculative hints that recommend that the browser should fetch a certain resource because there’s a high chance that it might be required.
If you want to learn more about speculative prerendering in the browser, Leena Sohoni and Addy Osmani have got you covered. In their article on web.dev, they dive deep into how speculative prefetching and prerendering are used, the drawbacks of the current implementations, and popular external libraries that implement sophisticated speculation. A great solution to shorten waiting times and cater for instant page-loads. (cm)
6. Smart Interface Design Patterns
We’ve just added a few new videos to “Smart Interface Design Patterns”, a 7h-video course with Vitaly Friedman, focused on fine little details that make for smarter interface design — from complex navigation to filters, tables and web forms. Check the free preview.
The course is created specifically for interface designers, UI engineers and developers who’d love to be prepared for complex UI/UX challenges. There is a live UX training that with UX certification that happens twice a year. Ah, there are just a few early-bird-tickets left! Jump to the details.
7. Free Performance Analyzers
There are quite a lot of potential performance pitfalls that stay unnoticed easily. Code duplicates or inline images, for example. DebugBear offers some quick and easy tools that help you uncover common performance bottlenecks like these.
One of the tools is the HTML Size Analyzer. You can paste your HTML code or enter a URL, and the analyzer will analyze the HTML size to catch bloat like inline images, large React hydration state, or code duplication. The Browser Resource Hint Validator checks if your resource hints are working correctly and if there are unused hints that you might want to consider removing.
If you are experiencing a slow site, the problem might not always be the site, though. Browser extensions can have a negative impact on performance, too. The Chrome Extension Performance Lookup shows you the impact that the top 1,000 Chrome extensions have when loading a website. Three useful tools that you might want to keep close. (cm)
From our sponsor
Build In-Demand Skills In Northwestern’s Online MS In Information Design And Strategy
Prepare for today’s communication roles Northwestern’s MS in Information Design.
8. Optimizing LCP
Largest Contentful Paint (LCP) represents the time from when a user starts loading a web page until the moment when the largest image or text block within the viewport finishes rendering. Google recommends that developers should aim for an LCP time of 2.5 seconds max, for at least 75% of page visits. However, only a bit more than half of sites meet that threshold, making LCP the Core Web Vitals metric that developers struggle with most. But why? And how can we do better?
In his GoogleIO talk, Philip Walton explores what makes LCP so hard to optimize. He offers concrete strategies to break this complex metric down into a few simple parts, making it much easier to reason about and, ultimately, improve the experience for all users. A comprehensive deep-dive into LCP that every developer should see. (cm)
9. New On Smashing Job Board
10. Recent Smashing Articles
That’s All, Folks!
Thank you so much for reading and for your support in helping us keep the web dev and design community strong with our newsletter. See you next time!
This newsletter issue was written and edited by Cosima Mielke (cm), Vitaly Friedman (vf) and Iris Lješnjanin (il).
Sent to truly smashing readers via Mailchimp.
We sincerely appreciate your kind support. You rock.
Follow us on Twitter • Join us on Facebook