Closed sindresorhus closed 3 years ago
LGTM. FYI, running the same perf scenario in #46 results in a runtime of ~340 ms.
const limit = plimit(10000000);
const start = Date.now();
await Promise.all([...Array(100000)].map(_ => limit(async () => Promise.resolve())));
console.log(Date.now() - start, 'plimit');
The extra 40ms is probably because I'm using classes and yallist
uses plain functions. Doesn't matter though. V8 will eventually make it as fast or faster.
Thanks for bringing this up and testing 🙌🏻
By using a queue data structure.
Closes #46