4 ms·
This is what I don't really get. It seems like some people are under the impression that generating and parsing HTML is slow or takes a lot of resources. In alm
by fyfy18 7y ago
This is what I don't really get. It seems like some people are under the impression that generating and parsing HTML is slow or takes a lot of resources. In almost all cases it's going to be faster and less resource intensive than generating JSON - especially if you are just using a templating language to interpolate some values. I agree that JSON could lead to less data being transferred over the wire, but that assumes your client already has cached the megabytes of JavaScript needed for you SPA. For something like a news site it doesn't make sense.
On the client parsing is fast, but the slow part is the browser laying out the page and fetching new resources - but that is going to be slow anyway, even if you do client side rendering. To make that fast you need do something more intelligent than just rendering a different React component, as well as prefetching resources in the background. But how many SPAs actually bother trying to do that?
I agree that SPAs have their place, and they have a lot of advantages over what we had before, but I just don't understand how it has seemingly become the default for any kind of web development - with such disregard for performance.
- nathan_long 7y ago> I agree that JSON could lead to less data being transferred over the wire I haven't benchmarked the difference, but I bet HTTP compression removes most of the difference > but that assumes your client already has cached the megabytes of JavaScript needed for you SPA A cache that will need to be busted every time you deploy new code. You do deploy often, right?