Hacker News new | ask | show | jobs
by deergomoo 2010 days ago
Surely a JSON payload is almost always going to be considerably smaller than the contents of that payload laid out in an entire HTML document?
1 comments

It’s not the entire HTML document, it’s piecemeal. As for sizing equivalent data in HTML vs js, I remember reading an investigation that XML and JSON are generally closer than you would expect and that for some data structures, XML is terser.
It's not XML though, it's HTML. HTML with additional nodes for layout, class names, etc.

If you're not invalidating the cached code multiple times per day (which, in fairness, a lot of the stuff from Google, Facebook, etc probably are), an SPA should use less data over time than a comparable server rendered app. The initial outlay is bigger, but once it's cached you only need the raw data as you navigate around.