Hacker News new | past | comments | ask | show | jobs | submit login

“Should” being the key part of your comment: it’s quite rare in practice. Most SPAs are lucky to have page render in 2-3 seconds, or fully loaded in 10 - and my experience is using the latest iPhone in a major metro area around 10 ms from most major CDNs.



Yeah it would be great to see some numbers from anyone who might have them. I'd put money on SPAs being slower, inside the bell curve than, than the average traditional page load app.


It's a shame more companies don't keep the old version of their website around when they launch a redesign. It's pretty easy to visit https://i.reddit.com/ and https://m.reddit.com/ on your phone to see which one feels faster.


Forget “feels faster”, I use that for stability every time new reddit hangs - usually 2-3 times a day I have to do that because they don’t handle errors yet, and they recently added a new bug where you can’t tell whether a reply was sent.


SPAs don't make sense if it's not an 'application', but wouldn't a SPA be faster over time not having to reload the whole page and all that duplicate markup? Wouldn't the simple JSON calls be smaller than refetching and rerendering all of the HTML? Front-end application offer more than just no-reload though, like push notifications, real-time data, and offline caches.


It’s not that simple: you need to factor in size and latency, too. If my SPA loads 2MB of JavaScript and then makes 50 API calls, it’s going to be a lot slower than the server sending 20kb of HTML in a single response.

JSON may or may not be smaller or faster: if you have to load data you don’t need or, worse, chase links it’ll be worse. GraphQL may help but that’s bringing it closer to server-side performance, not exceeding it.

Things which aren’t possible otherwise are the best argument for SPAs, but another approach is progressive enhancement: you can load quickly and then load features as needed rather than locking in a big up-front cost if all you need are real-time updates or push notifications. There’s a spectrum of capabilities here and there won’t be a single right answer for every project.


It depends, as always. (Compressed) JSON is probably smaller than (compressed) HTML, but that doesn't necessarily translate to more round trips. And browsers are pretty good at rendering HTML, and at the same time SPAs will get in the way of translating the JSON to rendered HTML on screen.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: