Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,16 @@ export abstract class SnapAccountProvider extends BaseBip44AccountProvider {

if (options.type === `${AccountCreationType.Bip44DeriveIndexRange}`) {
if (batched) {
const start = performance.now();

// Batch account creations.
snapAccounts = await createAccountsV2(options);

console.log(
`[PERFORMANCE LOG] createBip44Accounts Bip44DeriveIndexRange batched: ${(performance.now() - start).toFixed(2)}ms`,
);
} else {
const start = performance.now();
const { range } = options;

// Create accounts one by one.
Expand All @@ -399,21 +406,36 @@ export abstract class SnapAccountProvider extends BaseBip44AccountProvider {

snapAccounts.push(snapAccount);
}

console.log(
`[PERFORMANCE LOG] createBip44Accounts Bip44DeriveIndexRange sequential: ${(performance.now() - start).toFixed(2)}ms`,
);
}

// Group indices are sequential, so we just need the starting index.
groupIndexOffset = options.range.from;
} else {
if (batched) {
const start = performance.now();

// Create account using new v2-like flow (no async flow + no Snap keyring events).
snapAccounts = await createAccountsV2(options);

console.log(
`[PERFORMANCE LOG] createBip44Accounts Bip44DeriveIndex batched: ${(performance.now() - start).toFixed(2)}ms`,
);
} else {
const start = performance.now();
const { groupIndex } = options;

// Create account using the existing v1 flow.
const snapAccount = await createAccountV1(groupIndex);

snapAccounts = [snapAccount];

console.log(
`[PERFORMANCE LOG] createBip44Accounts Bip44DeriveIndex sequential: ${(performance.now() - start).toFixed(2)}ms`,
);
}

// For single account, there will only be 1 account, so we can use the
Expand Down
Loading