Skip to content

Commit

Permalink
perf(cursor): remove unnecessary setTimeout() in eachAsync(), 4x …
Browse files Browse the repository at this point in the history
…speedup in basic benchmarks

Fix #8310
  • Loading branch information
vkarpov15 committed Nov 9, 2019
1 parent bea0b6d commit e9c69b3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/helpers/cursor/eachAsync.js
Expand Up @@ -99,13 +99,11 @@ function asyncQueue() {
};

function _step() {
setTimeout(() => {
inProgress = null;
if (_queue.length > 0) {
inProgress = id++;
const fn = _queue.shift();
fn(_step);
}
}, 0);
inProgress = null;
if (_queue.length > 0) {
inProgress = id++;
const fn = _queue.shift();
fn(_step);
}
}
}

0 comments on commit e9c69b3

Please sign in to comment.