0

I want to iterate over a large array such that it won't hang the browser, so I want each iteration to be async.

Both BlueBird.mapSeries(arr, (e) => console.log(e)); and BlueBird.each(arr, (e) => console.log(e)); are blocking so nothing happens until they finish.

Is BlueBird even the right framework for this? Is there another framework for this?

shinzou
  • 5,850
  • 10
  • 60
  • 124
  • first, what is a "large" array to you? About how many items are we talking here? and second, what operation do you want to perform on them? And `item => console.log(item)` is not really representative for the speed of your final code. The console is not meant to log *(and show)* hundreds or thousands of items at once. IMO the bottleneck here is most likely the logging not BlueBird. – Thomas Aug 02 '17 at 08:53
  • 500,000 and each iteration isn't trivial. @Thomas, I'll check without the logging. Edit: it hangs the browser... – shinzou Aug 02 '17 at 09:19
  • Doing 500k non-trivial iterations in the browser seems to be the wrong approach. What are you trying to do? – str Aug 02 '17 at 09:31

0 Answers0