Faster than light loading with the Speculation Rules API
The best loading time is none at all! With the new Speculation Rules API, your website’s load speed goes superluminal, and will feel as if instantaneous.
Jacob Kofoed
May 29, 2024
-
Rendering : Render the initial page Server-Side (SSR). Any later enhancement, like setting up events, etc., happens seamlessly and efficiently at the later hydration stage. -
Server response times : Server-side caching, database optimizations, and performant algorithms contribute to less time spent on the server and more time shipping bits. -
Server distribution : Cloud hosting ensures that no single server gets overwhelmed and that you always connect to geographically nearby machines (more on this later). -
Ship fewer bytes : Once the server starts streaming data to the client, we want to limit the stream's length so the client can focus on the next and most important step: getting something on the screen.
Lightspeed is too slow
Perceived performance ~= raw performance
Speculation rules to the rescue
Eagerness.
-
Eeager: This setting indicates that a resource should be prerendered as soon as possible. -
moderate: In Chrome, this setting indicates that a resource will prerender after 200 milliseconds of hover on a link (or on pointerdown event if that is sooner, and on mobile where there is no `hover` event). -
conservative: Triggers on pointers or touchdowns.
You can use Speculation Rules in toddle
See Andreas' implement Speculation rules in toddle