TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Optimizing for the Speed of Light

40 点作者 elemeno超过 5 年前

7 条评论

stormbrew超过 5 年前
&gt; In C#&#x2F;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&#x27;m not specifically familiar with C# or typescript&#x27;s async keyword implementations, but this.. shouldn&#x27;t be true?<p>If you can&#x27;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&#x27;s not a very good implementation of async&#x2F;await...
评论 #21898048 未加载
评论 #21898313 未加载
planck01超过 5 年前
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?
评论 #21899954 未加载
chupa-chups超过 5 年前
Since the site doesn&#x27;t load currently - which is a bit funny considering the title - archive.is comes to the rescue:<p><a href="http:&#x2F;&#x2F;archive.is&#x2F;8Wj44" rel="nofollow">http:&#x2F;&#x2F;archive.is&#x2F;8Wj44</a>
评论 #21898732 未加载
评论 #21899312 未加载
bgirard超过 5 年前
The article overlooks the end-to-end overhead of HTTP&#x2F;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&#x27;ll trade off CPU time to benefit warm loads where the cache is populated.<p>I&#x27;m hopeful someday the overhead will be made negligible but until then I&#x27;d suggest profiling the trade-offs.<p>Meanwhile data frameworks like Relay offer incremental flushing with much more flexibility all over a single request.
评论 #21898382 未加载
tyzerdak超过 5 年前
In android tutorials from Google they say we should make as little requests as we can because every request call takes much phone power
HenriNext超过 5 年前
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.
markb139超过 5 年前
I think the guy needs to read a bit more physics. Electricity travels at about 2&#x2F;3 the speed of light in copper wires.
评论 #21898163 未加载
评论 #21899614 未加载