Faster Web App Delivery with PRPL
addyosmani.com
addyosmani.com
49 requests
795 kB transferred
3.6 MB resources
Finish: 7.60 s
DOMContentLoaded: 1.03 sWhat did you expect, isn't the web now built this way, I doubt you can play a video from Netflix without javascript.
* * * block
* * frame block
* 1st-party css allow
* 1st-party frame allow
* 1st-party image allow
Some use CDN, allow 3rd party CSS and images, that's almost uMatrix defaults: * * * block
* * css allow
* * frame block
* * image allow
* 1st-party frame allow
Even facebook serves some visible content [1]. Yes, some sites require JS, youtube could have <video><source>, image lazy loading required JS, we've got <img loading=lazy> now.I gave up trying to fix it.
> I want to share with you my simple two-step secret to improving the performance of any website.
> 1. Make sure that the most important elements of the page download and render first.
> 2. Stop there.
> You don't need all that other crap. Have courage in your minimalism.
If you're obsessively worried about "flash of unstyled content", then recall that the user will always see something after they click the link to your page. Giving them an unresponsive blank screen for an indefinite period of time may not be the best first impression to make.
I make a distinction between web apps and web sites. Web sites should be server-side rendered (at least the initial render) for obvious reasons.
This is an important distinction to make. But far too many web sites try to place themselves in the "web app" category when they really don't belong. Using a heavyweight JS framework does not automatically make your blog or news site into an app; it just makes your blog or news site slow.
I've long thought that browsers should move to formalize the distinction between traditional web sites, and web apps. Apps should get access to the richer, more invasive APIs but only when the user instructs the browser to grant app-level permissions to the site, and at the expense of having stricter security and privacy policies enforced (ie. no third-party cookies, and probably no third-party scripts).
> Native phone apps don’t render their initial screen server-side. Why should web apps?
An extra RTT to local storage is pretty much always quicker than an extra RTT to a server. And it's not exactly unheard of for a mobile OS to cache a raster image of an app's screen to use the next time the user launches that app or browses through their collection of running apps.
The key requirement is that putting a site into app mode must be a tradeoff, not a mere expansion of capabilities/permissions. There has to be a disincentive to discourage non-app sites from unnecessarily requesting app-mode permissions. The most natural way to accomplish this would be restrictions that make it less practical and more expensive to exploit broader permissions to abuse users. Eg. if you want the browser to prompt me to give your site access to my location data, your site should have to surrender the ability to load trackers and ads from somebody else's servers—you should have to serve that up yourself from your own domain, or not at all.
This would obviously break a lot about how things are commonly done on the current web, but most of what would be broken is the creepy stuff that we probably shouldn't be tolerating to begin with, like the monstrosity that reCAPTCHA has turned into under Google's stewardship.
I’d also argue that the web is far more accessible than native apps, in that it’s cross platform and independent of any one vendor, currently. So there are valid reasons for considering the page load price of websites/web apps.
Also, know your target audience. I’m decidedly not okay with non application sites loading megabytes of JS just to function. However I’m okay with complex functionality provider by my very good and feature rich web based email client need a few MBs of JS to work on initial load, because the features justify the cost in that case
It’s not all or nothing
(To answer the obvious 'what a waste if the user fails to log in!' criticism, that's fewer than 0.2% of log in attempts. Most people benefit.)
Even bottom of body scripts (unless marked as defer) will download before images
When I’m at home with fibre I am happy with the idea of going ape and downloading all the things I might touch.
When I’m at the cottage, mobile, etc. I would be irritated if your website did all that.
I’d even love a way to decide just how much of a JPEG to download (that kind that LODs itself as you wait).
This already happens, unfortunately.
Svelte and Sapper get pretty close to what PRPL is describing, including much of the guidance of Next.js & Nuxt.js.
What can help? Browser hinting is one approach. Browser settings that make it easy to accept/reject irrelevant content are another approach. Browser proxies with compression and filters are another.
IMHO success looks like the user's agent/browser/phone/desktop saying "Please use this kind of quality of service profile for now, and send what's most relevant."
This PRPL is even worse, just makes the stateless HTML page stateful, keeping more active connections, and is a lot more complicated.
If you want a fast to load page, please keep it simple.
You are either using the service worker api wrong or don’t understand how slow and spotty Internet connections can be for a majority of users around the world. PWAs are a massive improvement of experience on the web—it lets you think of the end-user more than the developer experience.
> ...
> Simplicity of development and deployment
How? The description sounds pretty complicated, with all the code splittings, service workers, lazy loadings and server pushes...
> How do you implement the PRPL pattern?
looks like 'burn it all down & try something else'.
de-monolithizing the app, disaggregating the process is some of the most ongoing & interesting work in computer science. there are, however, few current examples that push this effort very far.