Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid unnecessary delay in pMapIterable
Eagerly invoke iterator.next() even when already at concurrency limit. Otherwise, when a slot frees up and we have the chance to invoke the mapper, we first have to wait for iterator.next() to resolve. During this time the free slot is unused. With this change the resolution of iterator.next() will already have started and there is at least a chance that it's ready by the time we want to invoke the mapper. In principle, one could even implement a configurable backlog for iterator.next() results. That would be a bigger change though. Fixes sindresorhus#78
- Loading branch information