Update 07-fetching-data.mdx#82862
Conversation
Promise.all or any of the other 3 static concurrency methods don't actually run requests in parallel, rather they execute concurrently. [Parallelism vs Concurrency](https://wiki.haskell.org/Parallelism_vs._Concurrency) [Promise Concurrency](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#promise_concurrency)
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
correct spelling error
format markdown Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
|
Hi, This is one of those topics where it is fairly easy to talk past each other. Let me first value the PR, there are good ideas here, I’ll add some review comments so we can land it. The root problem as I see it, is the placement of the comments and how the section hints at Whether operations run in parallel is a function of the host environment, not of Promise APIs. For example, when you call fetch twice, the network stack (browser or Node/undici) can issue both requests in parallel, but JavaScript itself remains single‑threaded. const a = fetch('/a'); // request is initiated here
const b = fetch('/b'); // and here
await Promise.all([a, b]); // this only awaits bothFor CPU-bound work, there's no such thing as parallelism without Worker Threads/Web Workers - and at best async/tasks just interleave, so that operations look concurrent. I'll leave some comments, let's discuss over those and try to land some changes :) |
add suggested changes
|
Thanks, I added your suggestions, pls take a look when you have the chance. |
Promise.all or any of the other 3 static concurrency methods don't actually run requests in parallel, rather they execute concurrently.
Parallelism vs Concurrency
Promise Concurrency