0

I am in a need to prove the performance of a single page application. I would compare it with an application that uses server side to fill the HTML content.

How would one do that? Obviously the Ajax JSON requests are faster than making a full request with all the html and other stuff everytime. But maybe just comparing page navigation speeds?

And would it be possible to do this on a local machine?

  • some browsers have an option to slow down bandwidth and latency to simulate poor connections, e.g. for a phone user. You could use such features to make the network overhead more measurable on a local machine. Note that the amount of data transferred is largely irrelevant, but the number of sequential requests has a larger impact – a large HTML response is roughly as fast as a large Ajax response, except that the HTML will launch secondary requests for resources like styles, images, iframes, …. – amon Apr 23 '16 at 22:04
2

It's pretty clear that the main difference, all other things being equal, is related to the number of HTTP requests. For example if your server-generated page uses the right cache control headers and best practices for all of the static assets, then a page navigation will only result in a single http request. It can be very very fast.

If your SPA issues multiple HTTP requests for JSON on each navigation because you're using a REST API, then it can be slower.

The best way to test is using or simulating a real world scenario. If you tested locally then you'd need to simulate network conditions with higher latency. You'd also need to consider the impact of cache control headers and other caching behavior. I don't think there's a hard and fast rule.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.