Never-Slow Mode a.k.a. Slightly-Fast Mode
github.com
github.com
A cynical part of me notes that adding more complexity to browsers just makes Chrome monoculture easier: I have no doubt that Google can win any war of "throw developers at it". But it feels like they're building a complexity debt nightmare that we'll all suffer from.
Edit: I guess the other and more direct angle for why Google would push this is that they can give "fast" sites a ranking boost in search, i.e. dictate what web pages do via soft power to make their job easier.
They can already do this though, right? They can even use the same criteria.
I guess the difference is they wouldn't have to measure it themselves and they could just trust the browser to enforce it. But they already have to execute the web page to get the indexed content, and the limits they're imposing here seem to be unworkable for most SPA's, since the document-level restrictions around things like images break down if you're going a long time without reloading the page. So it's only indexed content that would ever enable this in the first place.
The only benefit I can see is that it would allow them to bake the UI into the browser, which would make it more obvious to users. And that's great, except for the tiny problem that performance isn't binary and different browsers and environments will want to have different standards.
None of the restrictions here apply to service workers. Why not? Why shouldn't browsers like Opera Mini be able to apply a different list of restrictions that include service workers? And if we're OK with browsers applying extra restrictions, than what's the value of standardization?
In any case, it is impossible to prove that your JS code will not somehow exceed these limits on a rarely exercised execution path. So I recommend turning this on in production as soon as the halting problem is solved.
On the other hand, we have the modern frontend project with its 300 nodes in the dependency tree, of which a handful are written by whoever will be turning this on. Are you sure your i18n library isn't lazy-loading translations and you blow the budget once someone selects not-English?
Also, if scrolling increases the budget, doesn't that penalize sites for being loaded in larger browser windows as the user has to scroll less?
This isn't really what people like me meant when we said we wanted Google to use performance metrics in their ranking. We wanted Google to come up with its own internal metrics, not standardize them across the entire web. Because performance isn't standard, it's extremely context-specific, and it's important that sites like search engines and browsers be able to iterate quickly on their metrics and to change them depending on what the ecosystem currently looks like.
I genuinely just don't understand what value standardization has here other than to make the system easier to game and less flexible in the future.
What positive, consumer-friendly, non-scammy things are possible for us to do with a universally standardized set of performance criteria that we couldn't do with privately maintained, non-standardized sets of criteria?
Other big tech companies like Facebook or Netflix don't follow Google's approach, because most products are sprawling, and built by many teams and many engineers. Keeping a small, tight, codebase under those conditions doesn't work.
Contrast Never Slow mode with what the React folk are doing with React Fiber. They have rewritten their engine to allow JS execution that doesn't block the main thread. This is much more pragmatic than setting budgets and simply telling devs to try harder.
Too many people shovel on slow JavaScript libraries and make the user experience worse. Speed is a tradregy of the commons issue - it's time serious action was taken to resolve it.
I could imagine an <iframe allow-slow-performance-shares=33%>, and leaving the iframe to figure out how to subdivide this among itself and its children. (And something similar for the main document.)
Deploying this will be hard, since the slowest devices also tend to run outdated browsers (and thus won’t enforce limits anytime soon.)
No line of JavaScript may execute more than 200 milliseconds after the last user touch/tap.
That would still let video sites play videos, but everything else would have to be 'ready to view' within 200ms. Let the developer decide if they want to achieve that by making resources smaller, having fewer resources, getting rid of js frameworks, etc.
Sites which need more time could demand the user hold a finger on the screen while they load up their heavy frameworks, but that would be a clear "we are slow" indicator the site would want to avoid.
This is how Opera Mini "implements" JavaScript. The Opera Mini server will run whatever JavaScript code there is in the page for ~2 seconds. Whatever can be seen on the screen at that point is sent to the Opera Mini client.
It works good enough for things like SPAs and "click here to show more".