From: Chris Duncan Date: Mon, 14 Jul 2025 16:44:27 +0000 (-0700) Subject: Use for loop instead of map function for performance. X-Git-Tag: v0.10.5~57^2~21 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=bcd64e87e701ef00a85f5ae2141ce4baa661024d;p=libnemo.git Use for loop instead of map function for performance. --- diff --git a/src/lib/wallets/blake2b-wallet.ts b/src/lib/wallets/blake2b-wallet.ts index ab0dff3..5dfed71 100644 --- a/src/lib/wallets/blake2b-wallet.ts +++ b/src/lib/wallets/blake2b-wallet.ts @@ -159,13 +159,14 @@ export class Blake2bWallet extends Wallet { * @returns {Promise} */ async ckd (indexes: number[]): Promise { - const results = indexes.map(index => { + const results = [] + for (const index of indexes) { const indexHex = index.toString(16).padStart(8, '0').toUpperCase() const inputHex = `${bytes.toHex(this.seed)}${indexHex}`.padStart(72, '0') const inputBytes = hex.toBytes(inputHex) const privateKey: string = new Blake2b(32).update(inputBytes).digest('hex') - return { privateKey, index } - }) + results.push({ privateKey, index }) + } return results } }