> In C#/typescript you can no longer use the friendly `await` keyword that makes async calls almost as easy synchronous calls. Ironically, the `await` keyword makes it really easy to force HTTP requests to execute sequentially that could easily execute in parallel. This is what the pit of fail looks like!<p>I'm not specifically familiar with C# or typescript's async keyword implementations, but this.. shouldn't be true?<p>If you can't launch multiple requests and then gather their results either through aggregating to a single future or by awaiting on them individually (which will mean you will start acting on results somewhere between min(t1,t2,t3,..tn) and max(t1,t2,t3,..tn) time) while all of them proceed just as well as if you had done callbacks, that's not a very good implementation of async/await...
Summary: Many round trips of small api requests can add up a lot of latency. An often used tactic is to bundle requests. Even better is to locally cache data when possible.<p>Is this news for anybody here?
Since the site doesn't load currently - which is a bit funny considering the title - archive.is comes to the rescue:<p><a href="http://archive.is/8Wj44" rel="nofollow">http://archive.is/8Wj44</a>
The article overlooks the end-to-end overhead of HTTP/2 which unfortunately makes the trade-offs between batching API calls and bundling JavaScript very complex in practice. For instance in Chrome the overhead of an additional request is still several milliseconds of local CPU time. Which means in practice you'll trade off CPU time to benefit warm loads where the cache is populated.<p>I'm hopeful someday the overhead will be made negligible but until then I'd suggest profiling the trade-offs.<p>Meanwhile data frameworks like Relay offer incremental flushing with much more flexibility all over a single request.
Bundling is not only about performance though.<p>Fetching all resources in a single HTTP request (or all data in a single GraphQL query) avoids a lot of issues and workaround effort caused by non-deterministic completion order of multiple small requests.