Hacker News new | ask | show | jobs
by jen729w 1370 days ago
As usual, it depends.

I just tested my own site, which I built using Gatsby — a JS framework — and https://astro.build, whose entire schtick is that they deliver as little JS to the page as possible.

(Because I’m thinking of rebuilding my site using Astro. But that’s not relevant here.)

In the default test, my page loaded in 1.6s and Astro in 1.9s. In the ‘not bad’ ratings below the main figures, my site fared better.

Now that my page is loaded, Gatsby does some neat pre-loading on hover of links. So clicking around my site is literally instantaneous. The same is not true of Astro, where every click is a classic HTTP request.

I am not judging Astro. That’s not the point of this post. I’m no Gatsby fanboy, I think it’s horribly over-complicated. I’m just saying. It’s complicated.

4 comments

I bet it could be rewritten to feel instantaneous as well.

it's a common misconception that SSR implies no XHR at all. That's never been true except prior to IE5 adding the technique for outlook.

SSR doesn't mean no XHR, it usually just means that change in route means round trip to the server. If you're doing SSR only for the initial page load then it's typically called hydration.
The amount of JS to download and parse is only one component that makes SPAs slow. SPAs often have to do another request to fetch json. Depending on how far away you are from the web server, and some users are literally on the other end of the world, this latency can be really large. You don't just want to minimize the javascript you also want to minimize the round trips. But using a small js framework is a good start I think.
I'm pretty new to Astro, but I did see this official plugin https://docs.astro.build/en/guides/integrations-guide/prefet... which I believe does what you're looking for.
Woah! I was gonna play with Astro for a new site test, but I wanted the prefetch fast-nav that I’ve seen in NextJS and Gatsby. This looks like exactly what I want to make Astro so the trick! Thanks for sharing
Oh sweet, cheers!
>Now that my page is loaded, Gatsby does some neat pre-loading on hover of links. So clicking around my site is literally instantaneous.

*Except with touch-based interfaces. Which are the majority of browsers today.

It's true but even without prefetching it's still fast as hell.