4 ms·
I don't understand (but am open to be persuaded), isn't iteration in js now trivially easy and actually quite powerful? Especially since we can now put 'await'
by fergie 2y ago
I don't understand (but am open to be persuaded), isn't iteration in js now trivially easy and actually quite powerful? Especially since we can now put 'await' everywhere? What are the killer use cases for this lib?
- conartist6 2y agofor the record sprinkling await everywhere is not something you should take lightly. await is still probably the single most high-level high-overhead construct in JS, and putting it inside tight loops is a recipe for perf disaster
- dogboat 2y agoDepends what you are waiting for. Maybe an in memory cache hit---that you explicitly code---causes a sync resolve to happen, woohoo! But if it goes to IO and you are waiting for the event loop to schedule you back in you could be in for a shock even if the IO op is tiny. Especially doing it alot. Only matters probably on a high CPU usage server which hopefully you avoid by scaling up on cpu and using all the cores. On the other hand... you are being cooperative :) But tight loop IO is an antipattern ... as is doing a lot---millions---of IO ops from node (per request or job) that you need to worry about this (use a different language for your DB server!).
- tomeraberbach 2y agoI think there are two things the library makes easier than what you're suggesting: - Some people like/prefer writing iteration in a functional style, which this library enables - It's pretty easy to create unintentional async/concurrency bottlenecks with the simple `Promise.all` approach (see the home page example)