- From: Adam Rice <notifications@github.com>
- Date: Fri, 16 Jul 2021 19:15:58 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 17 July 2021 02:16:11 UTC
I added support for backpressure for sync iterators (calling `next()` inside pullAlgorithm) to see how much difference it would make. I also redid my measurements with a million iterations. Behaviour | Results (μs) ----|---- No special cases | 127 Special case sync iterables, respecting backpressure | 117 Special case sync iterables, ignoring backpressure | 103 Special case arrays, ignoring backpressure | 92 I think there's a couple of factors at play: 1. The ES standard sync-to-async conversion is just really complicated and expensive 2. Doing things asynchronously is slower than doing them synchronously, not just because of task dispatch, but because you need to keep more state on the heap Although in my new results "Special case sync iterables, ignoring backpressure" is no longer as fast as "Special case arrays, ignoring backpressure", it could definitely be made as fast by exposing the iterations algorithm from the JS engine. Whereas the ES standard sync-to-async behaviour is not going to be that fast with any amount of heroics. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/1083#issuecomment-881800480
Received on Saturday, 17 July 2021 02:16:11 UTC