Closed vjpr closed 3 years ago
Promise API is 3 to 4 times slower. I have tested this extensively. Callback API fits the JS "parallelism" very well.
Would pave the way for supporting modern API interfaces such as Node Streams, Web Streams, AsyncInterators. AbortController could also be used for early-exit scenarios.
Most of these things are unnecessary. Async Iterators make sense but streaming is pointless; not to mention that it is trivial to convert iterators to Streams. AbortController would add unnecessary overhead of checking on every iteration if cancellation is requested — something you can easily do with an Iterator and a for-loop.
Code could be simplified by removing the callback API. There are native promise apis for most functions now.
Not sure how performance is effected though - this would be the primary concern.
Would pave the way for supporting modern API interfaces such as Node Streams, Web Streams, AsyncInterators. AbortController could also be used for early-exit scenarios.