From: Chris Duncan Date: Mon, 11 Nov 2024 05:35:13 +0000 (-0800) Subject: Performance test does not show a huge improvement (half a second over a million recor... X-Git-Tag: v0.0.20~27 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=779cbcd58d96ddf5da889545c4f5895c16fb736e;p=libnemo.git Performance test does not show a huge improvement (half a second over a million records) using Promise.all so revert to simpler implementation. --- diff --git a/src/lib/wallet.ts b/src/lib/wallet.ts index 32242cb..3ed559d 100644 --- a/src/lib/wallet.ts +++ b/src/lib/wallet.ts @@ -72,17 +72,11 @@ abstract class Wallet { from = to to = swap } - const accountQueue = [] for (let i = from; i <= to; i++) { if (this.#accounts[i] == null) { - accountQueue.push(new Promise(resolve => { - this.ckd(i).then(account => this.#accounts[i] = account).then(resolve) - })) + this.#accounts[i] = await this.ckd(i) } } - if (accountQueue.length > 0) { - await Promise.allSettled(accountQueue) - } return this.#accounts.slice(from, to + 1) }