2 ms·
Author here: lots of people are weighing in saying this is a micro-optimization and/or an uncommon case (making independent, stateless requests in parallel). My
by brundolf 6y ago
Author here: lots of people are weighing in saying this is a micro-optimization and/or an uncommon case (making independent, stateless requests in parallel). My suspicion is that these people are not front-end programmers (a factor that I hadn't considered as making a difference, when writing this post).
On the server, maybe having a set of requests take two seconds instead of one second (without consuming extra CPU cycles) doesn't really matter. On the front-end, it matters a whole lot. People go to much greater lengths to shave off much smaller amounts of time. Otherwise people on orange websites complain about your site being slow ;)
On the server, maybe it's a really common case to be making requests that modify state, and/or to be stitching together several microservices that require IDs or other information to be passed between them. On the front-end, especially on first-load, you're often loading up several different datasets purely for display purposes. These are rarely written to depend on each other, because of the latency issue in my previous point.
It is interesting though to see that there's a difference in norms/use-cases between the two.
- TheCoelacanth 6y agoI don't think it's so much that a second is more significant on the front-end. An entire second is practically an eternity on the backend. The main difference is how much latency a typical request is likely to have. On the backend, this optimization would frequently only save you 50 ms, because you are making a low latency call to another service that you are running in the same datacenter.
- brundolf 6y agoThat's a good point. And I guess the payloads will often be smaller, because the large datasets often just stay in the DB until needed. Whereas if the front-end needs to load data for a huge table (from a location that's obviously not in the same datacenter), it's easy for this optimization to save you hundreds of milliseconds if not entire seconds.