Skip to content

Commit

Permalink
fix: single state tree at start up (#7056)
Browse files Browse the repository at this point in the history
* feat: use db state to load ws state

* feat: log state size

* fix: rename initStateFromAnchorState to checkAndPersistAnchorState

* fix: only persist anchor state if it's cp state

* fix: avoid redundant anchor state serialization
  • Loading branch information
twoeths authored Sep 10, 2024
1 parent cbc00c7 commit 6c1e335
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 50 deletions.
18 changes: 10 additions & 8 deletions packages/beacon-node/src/chain/initState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ export async function persistGenesisResult(
export async function persistAnchorState(
config: ChainForkConfig,
db: IBeaconDb,
anchorState: BeaconStateAllForks
anchorState: BeaconStateAllForks,
anchorStateBytes: Uint8Array
): Promise<void> {
if (anchorState.slot === GENESIS_SLOT) {
const genesisBlock = createGenesisBlock(config, anchorState);
await Promise.all([
db.blockArchive.add(genesisBlock),
db.block.add(genesisBlock),
db.stateArchive.add(anchorState),
db.stateArchive.putBinary(anchorState.slot, anchorStateBytes),
]);
} else {
await db.stateArchive.add(anchorState);
await db.stateArchive.putBinary(anchorState.slot, anchorStateBytes);
}
}

Expand Down Expand Up @@ -154,16 +155,17 @@ export async function initStateFromDb(
/**
* Initialize and persist an anchor state (either weak subjectivity or genesis)
*/
export async function initStateFromAnchorState(
export async function checkAndPersistAnchorState(
config: ChainForkConfig,
db: IBeaconDb,
logger: Logger,
anchorState: BeaconStateAllForks,
anchorStateBytes: Uint8Array,
{
isWithinWeakSubjectivityPeriod,
isCheckpointState,
}: {isWithinWeakSubjectivityPeriod: boolean; isCheckpointState: boolean}
): Promise<BeaconStateAllForks> {
): Promise<void> {
const expectedFork = config.getForkInfo(computeStartSlotAtEpoch(anchorState.fork.epoch));
const expectedForkVersion = toHex(expectedFork.version);
const stateFork = toHex(anchorState.fork.currentVersion);
Expand Down Expand Up @@ -191,9 +193,9 @@ export async function initStateFromAnchorState(
logger.warn("Checkpoint sync recommended, please use --help to see checkpoint sync options");
}

await persistAnchorState(config, db, anchorState);

return anchorState;
if (isCheckpointState || anchorState.slot === GENESIS_SLOT) {
await persistAnchorState(config, db, anchorState, anchorStateBytes);
}
}

export function initBeaconMetrics(metrics: Metrics, state: BeaconStateAllForks): void {
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {initStateFromAnchorState, initStateFromDb, initStateFromEth1} from "./chain/index.js";
export {checkAndPersistAnchorState, initStateFromDb, initStateFromEth1} from "./chain/index.js";
export {BeaconDb, type IBeaconDb} from "./db/index.js";
export {Eth1Provider, type IEth1Provider} from "./eth1/index.js";
export {createNodeJsLibp2p, type NodeJsLibp2pOpts} from "./network/index.js";
Expand All @@ -20,4 +20,4 @@ export {RestApiServer} from "./api/rest/base.js";
export type {RestApiServerOpts, RestApiServerModules, RestApiServerMetrics} from "./api/rest/base.js";

// Export type util for CLI - TEMP move to lodestar-types eventually
export {getStateTypeFromBytes} from "./util/multifork.js";
export {getStateTypeFromBytes, getStateSlotFromBytes} from "./util/multifork.js";
101 changes: 71 additions & 30 deletions packages/cli/src/cmds/beacon/initBeaconState.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import {ssz} from "@lodestar/types";
import {createBeaconConfig, BeaconConfig, ChainForkConfig} from "@lodestar/config";
import {Logger} from "@lodestar/utils";
import {Logger, formatBytes} from "@lodestar/utils";
import {
isWithinWeakSubjectivityPeriod,
ensureWithinWeakSubjectivityPeriod,
BeaconStateAllForks,
loadState,
loadStateAndValidators,
} from "@lodestar/state-transition";
import {
IBeaconDb,
IBeaconNodeOptions,
initStateFromAnchorState,
checkAndPersistAnchorState,
initStateFromEth1,
getStateTypeFromBytes,
} from "@lodestar/beacon-node";
Expand All @@ -25,32 +27,36 @@ import {
} from "../../networks/index.js";
import {BeaconArgs} from "./options.js";

type StateWithBytes = {state: BeaconStateAllForks; stateBytes: Uint8Array};

async function initAndVerifyWeakSubjectivityState(
config: BeaconConfig,
db: IBeaconDb,
logger: Logger,
store: BeaconStateAllForks,
wsState: BeaconStateAllForks,
dbStateBytes: StateWithBytes,
wsStateBytes: StateWithBytes,
wsCheckpoint: Checkpoint,
opts: {ignoreWeakSubjectivityCheck?: boolean} = {}
): Promise<{anchorState: BeaconStateAllForks; wsCheckpoint: Checkpoint}> {
const dbState = dbStateBytes.state;
const wsState = wsStateBytes.state;
// Check if the store's state and wsState are compatible
if (
store.genesisTime !== wsState.genesisTime ||
!ssz.Root.equals(store.genesisValidatorsRoot, wsState.genesisValidatorsRoot)
dbState.genesisTime !== wsState.genesisTime ||
!ssz.Root.equals(dbState.genesisValidatorsRoot, wsState.genesisValidatorsRoot)
) {
throw new Error(
"Db state and checkpoint state are not compatible, either clear the db or verify your checkpoint source"
);
}

// Pick the state which is ahead as an anchor to initialize the beacon chain
let anchorState = wsState;
let anchorState = wsStateBytes;
let anchorCheckpoint = wsCheckpoint;
let isCheckpointState = true;
if (store.slot > wsState.slot) {
anchorState = store;
anchorCheckpoint = getCheckpointFromState(store);
if (dbState.slot > wsState.slot) {
anchorState = dbStateBytes;
anchorCheckpoint = getCheckpointFromState(dbState);
isCheckpointState = false;
logger.verbose(
"Db state is ahead of the provided checkpoint state, using the db state to initialize the beacon chain"
Expand All @@ -59,19 +65,19 @@ async function initAndVerifyWeakSubjectivityState(

// Throw error unless user explicitly asked not to, in testnets can happen that wss period is too small
// that even some epochs of non finalization can cause finalized checkpoint to be out of valid range
const wssCheck = wrapFnError(() => ensureWithinWeakSubjectivityPeriod(config, anchorState, anchorCheckpoint));
const wssCheck = wrapFnError(() => ensureWithinWeakSubjectivityPeriod(config, anchorState.state, anchorCheckpoint));
const isWithinWeakSubjectivityPeriod = wssCheck.err === null;
if (!isWithinWeakSubjectivityPeriod && !opts.ignoreWeakSubjectivityCheck) {
throw wssCheck.err;
}

anchorState = await initStateFromAnchorState(config, db, logger, anchorState, {
await checkAndPersistAnchorState(config, db, logger, anchorState.state, anchorState.stateBytes, {
isWithinWeakSubjectivityPeriod,
isCheckpointState,
});

// Return the latest anchorState but still return original wsCheckpoint to validate in backfill
return {anchorState, wsCheckpoint};
return {anchorState: anchorState.state, wsCheckpoint};
}

/**
Expand All @@ -96,8 +102,20 @@ export async function initBeaconState(
}
// fetch the latest state stored in the db which will be used in all cases, if it exists, either
// i) used directly as the anchor state
// ii) used during verification of a weak subjectivity state,
const lastDbState = await db.stateArchive.lastValue();
// ii) used to load and verify a weak subjectivity state,
const lastDbSlot = await db.stateArchive.lastKey();
const stateBytes = lastDbSlot !== null ? await db.stateArchive.getBinary(lastDbSlot) : null;
let lastDbState: BeaconStateAllForks | null = null;
let lastDbValidatorsBytes: Uint8Array | null = null;
let lastDbStateWithBytes: StateWithBytes | null = null;
if (stateBytes) {
logger.verbose("Found the last archived state", {slot: lastDbSlot, size: formatBytes(stateBytes.length)});
const {state, validatorsBytes} = loadStateAndValidators(chainForkConfig, stateBytes);
lastDbState = state;
lastDbValidatorsBytes = validatorsBytes;
lastDbStateWithBytes = {state, stateBytes: stateBytes};
}

if (lastDbState) {
const config = createBeaconConfig(chainForkConfig, lastDbState.genesisValidatorsRoot);
const wssCheck = isWithinWeakSubjectivityPeriod(config, lastDbState, getCheckpointFromState(lastDbState));
Expand All @@ -107,27 +125,34 @@ export async function initBeaconState(
// Forcing to sync from checkpoint is only recommended if node is taking too long to sync from last db state.
// It is important to remind the user to remove this flag again unless it is absolutely necessary.
if (wssCheck) {
logger.warn("Forced syncing from checkpoint even though db state is within weak subjectivity period");
logger.warn(
`Forced syncing from checkpoint even though db state at slot ${lastDbState.slot} is within weak subjectivity period`
);
logger.warn("Please consider removing --forceCheckpointSync flag unless absolutely necessary");
}
} else {
// All cases when we want to directly use lastDbState as the anchor state:
// - if no checkpoint sync args provided, or
// - the lastDbState is within weak subjectivity period:
if ((!args.checkpointState && !args.checkpointSyncUrl) || wssCheck) {
const anchorState = await initStateFromAnchorState(config, db, logger, lastDbState, {
if (stateBytes === null) {
// this never happens
throw Error(`There is no stateBytes for the lastDbState at slot ${lastDbState.slot}`);
}
await checkAndPersistAnchorState(config, db, logger, lastDbState, stateBytes, {
isWithinWeakSubjectivityPeriod: wssCheck,
isCheckpointState: false,
});
return {anchorState};
return {anchorState: lastDbState};
}
}
}

// See if we can sync state using checkpoint sync args or else start from genesis
if (args.checkpointState) {
return readWSState(
lastDbState,
lastDbStateWithBytes,
lastDbValidatorsBytes,
{
checkpointState: args.checkpointState,
wssCheckpoint: args.wssCheckpoint,
Expand All @@ -139,7 +164,8 @@ export async function initBeaconState(
);
} else if (args.checkpointSyncUrl) {
return fetchWSStateFromBeaconApi(
lastDbState,
lastDbStateWithBytes,
lastDbValidatorsBytes,
{
checkpointSyncUrl: args.checkpointSyncUrl,
wssCheckpoint: args.wssCheckpoint,
Expand All @@ -153,10 +179,10 @@ export async function initBeaconState(
const genesisStateFile = args.genesisStateFile || getGenesisFileUrl(args.network || defaultNetwork);
if (genesisStateFile && !args.forceGenesis) {
const stateBytes = await downloadOrLoadFile(genesisStateFile);
let anchorState = getStateTypeFromBytes(chainForkConfig, stateBytes).deserializeToViewDU(stateBytes);
const anchorState = getStateTypeFromBytes(chainForkConfig, stateBytes).deserializeToViewDU(stateBytes);
const config = createBeaconConfig(chainForkConfig, anchorState.genesisValidatorsRoot);
const wssCheck = isWithinWeakSubjectivityPeriod(config, anchorState, getCheckpointFromState(anchorState));
anchorState = await initStateFromAnchorState(config, db, logger, anchorState, {
await checkAndPersistAnchorState(config, db, logger, anchorState, stateBytes, {
isWithinWeakSubjectivityPeriod: wssCheck,
isCheckpointState: true,
});
Expand All @@ -170,7 +196,8 @@ export async function initBeaconState(
}

async function readWSState(
lastDbState: BeaconStateAllForks | null,
lastDbStateBytes: StateWithBytes | null,
lastDbValidatorsBytes: Uint8Array | null,
wssOpts: {checkpointState: string; wssCheckpoint?: string; ignoreWeakSubjectivityCheck?: boolean},
chainForkConfig: ChainForkConfig,
db: IBeaconDb,
Expand All @@ -180,19 +207,28 @@ async function readWSState(
// if a weak subjectivity checkpoint has been provided, it is used for additional verification
// otherwise, the state itself is used for verification (not bad, because the trusted state has been explicitly provided)
const {checkpointState, wssCheckpoint, ignoreWeakSubjectivityCheck} = wssOpts;
const lastDbState = lastDbStateBytes?.state ?? null;

const stateBytes = await downloadOrLoadFile(checkpointState);
const wsState = getStateTypeFromBytes(chainForkConfig, stateBytes).deserializeToViewDU(stateBytes);
let wsState: BeaconStateAllForks;
if (lastDbState && lastDbValidatorsBytes) {
// use lastDbState to load wsState if possible to share the same state tree
wsState = loadState(chainForkConfig, lastDbState, stateBytes, lastDbValidatorsBytes).state;
} else {
wsState = getStateTypeFromBytes(chainForkConfig, stateBytes).deserializeToViewDU(stateBytes);
}
const config = createBeaconConfig(chainForkConfig, wsState.genesisValidatorsRoot);
const store = lastDbState ?? wsState;
const wsStateBytes = {state: wsState, stateBytes};
const store = lastDbStateBytes ?? wsStateBytes;
const checkpoint = wssCheckpoint ? getCheckpointFromArg(wssCheckpoint) : getCheckpointFromState(wsState);
return initAndVerifyWeakSubjectivityState(config, db, logger, store, wsState, checkpoint, {
return initAndVerifyWeakSubjectivityState(config, db, logger, store, wsStateBytes, checkpoint, {
ignoreWeakSubjectivityCheck,
});
}

async function fetchWSStateFromBeaconApi(
lastDbState: BeaconStateAllForks | null,
lastDbStateBytes: StateWithBytes | null,
lastDbValidatorsBytes: Uint8Array | null,
wssOpts: {checkpointSyncUrl: string; wssCheckpoint?: string; ignoreWeakSubjectivityCheck?: boolean},
chainForkConfig: ChainForkConfig,
db: IBeaconDb,
Expand All @@ -213,10 +249,15 @@ async function fetchWSStateFromBeaconApi(
throw e;
}

const {wsState, wsCheckpoint} = await fetchWeakSubjectivityState(chainForkConfig, logger, wssOpts);
const {wsState, wsStateBytes, wsCheckpoint} = await fetchWeakSubjectivityState(chainForkConfig, logger, wssOpts, {
lastDbState: lastDbStateBytes?.state ?? null,
lastDbValidatorsBytes,
});

const config = createBeaconConfig(chainForkConfig, wsState.genesisValidatorsRoot);
const store = lastDbState ?? wsState;
return initAndVerifyWeakSubjectivityState(config, db, logger, store, wsState, wsCheckpoint, {
const wsStateWithBytes = {state: wsState, stateBytes: wsStateBytes};
const store = lastDbStateBytes ?? wsStateWithBytes;
return initAndVerifyWeakSubjectivityState(config, db, logger, store, wsStateWithBytes, wsCheckpoint, {
ignoreWeakSubjectivityCheck: wssOpts.ignoreWeakSubjectivityCheck,
});
}
35 changes: 27 additions & 8 deletions packages/cli/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import got from "got";
import {ENR} from "@chainsafe/enr";
import {SLOTS_PER_EPOCH} from "@lodestar/params";
import {HttpHeader, MediaType, WireFormat, getClient} from "@lodestar/api";
import {getStateTypeFromBytes} from "@lodestar/beacon-node";
import {getStateSlotFromBytes} from "@lodestar/beacon-node";
import {ChainConfig, ChainForkConfig} from "@lodestar/config";
import {Checkpoint} from "@lodestar/types/phase0";
import {Slot} from "@lodestar/types";
import {fromHex, callFnWhenAwait, Logger} from "@lodestar/utils";
import {BeaconStateAllForks, getLatestBlockRoot, computeCheckpointEpochAtStateSlot} from "@lodestar/state-transition";
import {fromHex, callFnWhenAwait, Logger, formatBytes} from "@lodestar/utils";
import {
BeaconStateAllForks,
getLatestBlockRoot,
computeCheckpointEpochAtStateSlot,
loadState,
} from "@lodestar/state-transition";
import {parseBootnodesFile} from "../util/format.js";
import * as mainnet from "./mainnet.js";
import * as dev from "./dev.js";
Expand Down Expand Up @@ -140,8 +145,12 @@ export function readBootnodes(bootnodesFilePath: string): string[] {
export async function fetchWeakSubjectivityState(
config: ChainForkConfig,
logger: Logger,
{checkpointSyncUrl, wssCheckpoint}: {checkpointSyncUrl: string; wssCheckpoint?: string}
): Promise<{wsState: BeaconStateAllForks; wsCheckpoint: Checkpoint}> {
{checkpointSyncUrl, wssCheckpoint}: {checkpointSyncUrl: string; wssCheckpoint?: string},
{
lastDbState,
lastDbValidatorsBytes,
}: {lastDbState: BeaconStateAllForks | null; lastDbValidatorsBytes: Uint8Array | null}
): Promise<{wsState: BeaconStateAllForks; wsStateBytes: Uint8Array; wsCheckpoint: Checkpoint}> {
try {
let wsCheckpoint: Checkpoint | null;
let stateId: Slot | "finalized";
Expand Down Expand Up @@ -169,21 +178,31 @@ export async function fetchWeakSubjectivityState(
}
);

const stateBytes = await callFnWhenAwait(
const wsStateBytes = await callFnWhenAwait(
getStatePromise,
() => logger.info("Download in progress, please wait..."),
GET_STATE_LOG_INTERVAL
).then((res) => {
return res.ssz();
});

logger.info("Download completed", {stateId});
const wsSlot = getStateSlotFromBytes(wsStateBytes);
const logData = {stateId, size: formatBytes(wsStateBytes.length)};
logger.info("Download completed", typeof stateId === "number" ? logData : {...logData, slot: wsSlot});
// It should not be required to get fork type from bytes but Checkpointz does not return
// Eth-Consensus-Version header, see https://github.com/ethpandaops/checkpointz/issues/164
const wsState = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
let wsState: BeaconStateAllForks;
if (lastDbState && lastDbValidatorsBytes) {
// use lastDbState to load wsState if possible to share the same state tree
wsState = loadState(config, lastDbState, wsStateBytes, lastDbValidatorsBytes).state;
} else {
const stateType = config.getForkTypes(wsSlot).BeaconState;
wsState = stateType.deserializeToViewDU(wsStateBytes);
}

return {
wsState,
wsStateBytes,
wsCheckpoint: wsCheckpoint ?? getCheckpointFromState(wsState),
};
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions packages/state-transition/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ export * from "./validator.js";
export * from "./weakSubjectivity.js";
export * from "./deposit.js";
export * from "./electra.js";
export * from "./loadState/index.js";
2 changes: 1 addition & 1 deletion packages/state-transition/src/util/loadState/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {loadState} from "./loadState.js";
export {loadState, loadStateAndValidators} from "./loadState.js";
Loading

1 comment on commit 6c1e335

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 6c1e335 Previous: cbc00c7 Ratio
Object set x1000 81.364 ns/op 25.128 ns/op 3.24
forkChoice updateHead vc 600000 bc 64 eq 300000 54.394 ms/op 14.940 ms/op 3.64
Full benchmark results
Benchmark suite Current: 6c1e335 Previous: cbc00c7 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.0004 ms/op 1.8118 ms/op 1.10
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 50.520 us/op 40.083 us/op 1.26
BLS verify - blst 945.66 us/op 851.81 us/op 1.11
BLS verifyMultipleSignatures 3 - blst 1.2779 ms/op 1.2866 ms/op 0.99
BLS verifyMultipleSignatures 8 - blst 1.8806 ms/op 2.0971 ms/op 0.90
BLS verifyMultipleSignatures 32 - blst 5.9542 ms/op 4.4533 ms/op 1.34
BLS verifyMultipleSignatures 64 - blst 11.054 ms/op 8.3196 ms/op 1.33
BLS verifyMultipleSignatures 128 - blst 17.917 ms/op 16.000 ms/op 1.12
BLS deserializing 10000 signatures 698.41 ms/op 616.38 ms/op 1.13
BLS deserializing 100000 signatures 7.1478 s/op 6.1539 s/op 1.16
BLS verifyMultipleSignatures - same message - 3 - blst 1.1945 ms/op 932.20 us/op 1.28
BLS verifyMultipleSignatures - same message - 8 - blst 1.2832 ms/op 1.0553 ms/op 1.22
BLS verifyMultipleSignatures - same message - 32 - blst 2.0519 ms/op 1.6636 ms/op 1.23
BLS verifyMultipleSignatures - same message - 64 - blst 3.0620 ms/op 2.4008 ms/op 1.28
BLS verifyMultipleSignatures - same message - 128 - blst 5.2129 ms/op 3.8949 ms/op 1.34
BLS aggregatePubkeys 32 - blst 22.203 us/op 18.227 us/op 1.22
BLS aggregatePubkeys 128 - blst 73.881 us/op 63.593 us/op 1.16
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 93.932 ms/op 50.568 ms/op 1.86
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 58.802 ms/op 54.606 ms/op 1.08
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 40.844 ms/op 30.469 ms/op 1.34
getSlashingsAndExits - default max 107.38 us/op 70.324 us/op 1.53
getSlashingsAndExits - 2k 325.84 us/op 237.45 us/op 1.37
proposeBlockBody type=full, size=empty 6.5283 ms/op 5.0115 ms/op 1.30
isKnown best case - 1 super set check 481.00 ns/op 466.00 ns/op 1.03
isKnown normal case - 2 super set checks 477.00 ns/op 448.00 ns/op 1.06
isKnown worse case - 16 super set checks 420.00 ns/op 439.00 ns/op 0.96
InMemoryCheckpointStateCache - add get delete 4.4810 us/op 2.5380 us/op 1.77
updateUnfinalizedPubkeys - updating 10 pubkeys 1.2332 ms/op 619.54 us/op 1.99
updateUnfinalizedPubkeys - updating 100 pubkeys 2.8586 ms/op 2.2422 ms/op 1.27
updateUnfinalizedPubkeys - updating 1000 pubkeys 61.150 ms/op 39.885 ms/op 1.53
validate api signedAggregateAndProof - struct 1.5404 ms/op 1.4795 ms/op 1.04
validate gossip signedAggregateAndProof - struct 1.5780 ms/op 1.8404 ms/op 0.86
validate gossip attestation - vc 640000 1.1358 ms/op 958.80 us/op 1.18
batch validate gossip attestation - vc 640000 - chunk 32 164.46 us/op 121.09 us/op 1.36
batch validate gossip attestation - vc 640000 - chunk 64 149.19 us/op 105.10 us/op 1.42
batch validate gossip attestation - vc 640000 - chunk 128 153.11 us/op 95.676 us/op 1.60
batch validate gossip attestation - vc 640000 - chunk 256 154.95 us/op 93.111 us/op 1.66
pickEth1Vote - no votes 1.9039 ms/op 986.77 us/op 1.93
pickEth1Vote - max votes 12.282 ms/op 7.2540 ms/op 1.69
pickEth1Vote - Eth1Data hashTreeRoot value x2048 26.259 ms/op 15.086 ms/op 1.74
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 37.548 ms/op 20.110 ms/op 1.87
pickEth1Vote - Eth1Data fastSerialize value x2048 735.92 us/op 361.35 us/op 2.04
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.4006 ms/op 3.5351 ms/op 1.81
bytes32 toHexString 944.00 ns/op 611.00 ns/op 1.55
bytes32 Buffer.toString(hex) 322.00 ns/op 469.00 ns/op 0.69
bytes32 Buffer.toString(hex) from Uint8Array 587.00 ns/op 550.00 ns/op 1.07
bytes32 Buffer.toString(hex) + 0x 306.00 ns/op 442.00 ns/op 0.69
Object access 1 prop 0.23900 ns/op 0.32600 ns/op 0.73
Map access 1 prop 0.15800 ns/op 0.32900 ns/op 0.48
Object get x1000 7.3030 ns/op 5.5140 ns/op 1.32
Map get x1000 7.5090 ns/op 6.0700 ns/op 1.24
Object set x1000 81.364 ns/op 25.128 ns/op 3.24
Map set x1000 50.163 ns/op 22.162 ns/op 2.26
Return object 10000 times 0.35670 ns/op 0.30270 ns/op 1.18
Throw Error 10000 times 4.3034 us/op 2.9327 us/op 1.47
toHex 210.83 ns/op 111.89 ns/op 1.88
Buffer.from 190.51 ns/op 114.80 ns/op 1.66
shared Buffer 125.22 ns/op 79.209 ns/op 1.58
fastMsgIdFn sha256 / 200 bytes 2.8930 us/op 2.2170 us/op 1.30
fastMsgIdFn h32 xxhash / 200 bytes 398.00 ns/op 495.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 200 bytes 349.00 ns/op 475.00 ns/op 0.73
fastMsgIdFn sha256 / 1000 bytes 8.7130 us/op 6.0390 us/op 1.44
fastMsgIdFn h32 xxhash / 1000 bytes 538.00 ns/op 559.00 ns/op 0.96
fastMsgIdFn h64 xxhash / 1000 bytes 446.00 ns/op 543.00 ns/op 0.82
fastMsgIdFn sha256 / 10000 bytes 77.610 us/op 50.755 us/op 1.53
fastMsgIdFn h32 xxhash / 10000 bytes 2.2040 us/op 2.0620 us/op 1.07
fastMsgIdFn h64 xxhash / 10000 bytes 1.3800 us/op 1.3780 us/op 1.00
send data - 1000 256B messages 19.270 ms/op 12.643 ms/op 1.52
send data - 1000 512B messages 25.407 ms/op 17.144 ms/op 1.48
send data - 1000 1024B messages 36.085 ms/op 22.076 ms/op 1.63
send data - 1000 1200B messages 43.847 ms/op 24.603 ms/op 1.78
send data - 1000 2048B messages 54.629 ms/op 31.035 ms/op 1.76
send data - 1000 4096B messages 57.769 ms/op 29.182 ms/op 1.98
send data - 1000 16384B messages 132.27 ms/op 69.720 ms/op 1.90
send data - 1000 65536B messages 433.76 ms/op 264.21 ms/op 1.64
enrSubnets - fastDeserialize 64 bits 2.3640 us/op 1.4960 us/op 1.58
enrSubnets - ssz BitVector 64 bits 662.00 ns/op 651.00 ns/op 1.02
enrSubnets - fastDeserialize 4 bits 252.00 ns/op 392.00 ns/op 0.64
enrSubnets - ssz BitVector 4 bits 580.00 ns/op 639.00 ns/op 0.91
prioritizePeers score -10:0 att 32-0.1 sync 2-0 215.18 us/op 135.66 us/op 1.59
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 215.44 us/op 139.28 us/op 1.55
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 415.75 us/op 300.94 us/op 1.38
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 564.75 us/op 532.97 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 932.87 us/op 636.77 us/op 1.47
array of 16000 items push then shift 1.7989 us/op 1.3693 us/op 1.31
LinkedList of 16000 items push then shift 9.6060 ns/op 6.6190 ns/op 1.45
array of 16000 items push then pop 172.52 ns/op 115.55 ns/op 1.49
LinkedList of 16000 items push then pop 11.403 ns/op 6.6070 ns/op 1.73
array of 24000 items push then shift 3.4960 us/op 2.0110 us/op 1.74
LinkedList of 24000 items push then shift 11.326 ns/op 6.8920 ns/op 1.64
array of 24000 items push then pop 235.19 ns/op 151.22 ns/op 1.56
LinkedList of 24000 items push then pop 9.8270 ns/op 6.4770 ns/op 1.52
intersect bitArray bitLen 8 7.8050 ns/op 5.6860 ns/op 1.37
intersect array and set length 8 79.882 ns/op 39.754 ns/op 2.01
intersect bitArray bitLen 128 38.751 ns/op 27.281 ns/op 1.42
intersect array and set length 128 1.2246 us/op 603.15 ns/op 2.03
bitArray.getTrueBitIndexes() bitLen 128 3.8250 us/op 2.0720 us/op 1.85
bitArray.getTrueBitIndexes() bitLen 248 6.4220 us/op 3.6310 us/op 1.77
bitArray.getTrueBitIndexes() bitLen 512 14.963 us/op 7.4670 us/op 2.00
Buffer.concat 32 items 2.2580 us/op 1.1700 us/op 1.93
Uint8Array.set 32 items 3.5580 us/op 1.8630 us/op 1.91
Buffer.copy 3.5150 us/op 2.1230 us/op 1.66
Uint8Array.set - with subarray 5.3280 us/op 3.4250 us/op 1.56
Uint8Array.set - without subarray 2.9270 us/op 1.9900 us/op 1.47
getUint32 - dataview 424.00 ns/op 500.00 ns/op 0.85
getUint32 - manual 432.00 ns/op 488.00 ns/op 0.89
Set add up to 64 items then delete first 3.9648 us/op 2.7286 us/op 1.45
OrderedSet add up to 64 items then delete first 7.7565 us/op 4.5283 us/op 1.71
Set add up to 64 items then delete last 5.1704 us/op 2.2608 us/op 2.29
OrderedSet add up to 64 items then delete last 7.9595 us/op 3.3939 us/op 2.35
Set add up to 64 items then delete middle 4.4484 us/op 2.1758 us/op 2.04
OrderedSet add up to 64 items then delete middle 11.216 us/op 5.7707 us/op 1.94
Set add up to 128 items then delete first 10.628 us/op 5.3039 us/op 2.00
OrderedSet add up to 128 items then delete first 17.964 us/op 8.5591 us/op 2.10
Set add up to 128 items then delete last 10.519 us/op 5.4608 us/op 1.93
OrderedSet add up to 128 items then delete last 16.337 us/op 8.3132 us/op 1.97
Set add up to 128 items then delete middle 11.412 us/op 5.7385 us/op 1.99
OrderedSet add up to 128 items then delete middle 27.718 us/op 14.861 us/op 1.87
Set add up to 256 items then delete first 22.263 us/op 11.520 us/op 1.93
OrderedSet add up to 256 items then delete first 32.817 us/op 17.765 us/op 1.85
Set add up to 256 items then delete last 19.293 us/op 11.173 us/op 1.73
OrderedSet add up to 256 items then delete last 28.184 us/op 18.612 us/op 1.51
Set add up to 256 items then delete middle 17.597 us/op 10.444 us/op 1.68
OrderedSet add up to 256 items then delete middle 62.439 us/op 41.895 us/op 1.49
transfer serialized Status (84 B) 2.3710 us/op 1.6810 us/op 1.41
copy serialized Status (84 B) 1.8320 us/op 1.5090 us/op 1.21
transfer serialized SignedVoluntaryExit (112 B) 2.9310 us/op 1.7930 us/op 1.63
copy serialized SignedVoluntaryExit (112 B) 2.6900 us/op 1.7040 us/op 1.58
transfer serialized ProposerSlashing (416 B) 3.1360 us/op 3.0470 us/op 1.03
copy serialized ProposerSlashing (416 B) 3.0870 us/op 2.4650 us/op 1.25
transfer serialized Attestation (485 B) 2.6030 us/op 2.5420 us/op 1.02
copy serialized Attestation (485 B) 3.1580 us/op 1.9860 us/op 1.59
transfer serialized AttesterSlashing (33232 B) 3.2380 us/op 1.9180 us/op 1.69
copy serialized AttesterSlashing (33232 B) 15.329 us/op 4.4770 us/op 3.42
transfer serialized Small SignedBeaconBlock (128000 B) 5.1310 us/op 2.6310 us/op 1.95
copy serialized Small SignedBeaconBlock (128000 B) 44.552 us/op 10.878 us/op 4.10
transfer serialized Avg SignedBeaconBlock (200000 B) 6.6740 us/op 3.1690 us/op 2.11
copy serialized Avg SignedBeaconBlock (200000 B) 72.347 us/op 44.273 us/op 1.63
transfer serialized BlobsSidecar (524380 B) 9.7240 us/op 4.4490 us/op 2.19
copy serialized BlobsSidecar (524380 B) 197.95 us/op 132.10 us/op 1.50
transfer serialized Big SignedBeaconBlock (1000000 B) 7.3030 us/op 4.0730 us/op 1.79
copy serialized Big SignedBeaconBlock (1000000 B) 378.17 us/op 254.65 us/op 1.49
pass gossip attestations to forkchoice per slot 4.7891 ms/op 2.5784 ms/op 1.86
forkChoice updateHead vc 100000 bc 64 eq 0 817.69 us/op 414.31 us/op 1.97
forkChoice updateHead vc 600000 bc 64 eq 0 4.7045 ms/op 3.1233 ms/op 1.51
forkChoice updateHead vc 1000000 bc 64 eq 0 8.1505 ms/op 4.7668 ms/op 1.71
forkChoice updateHead vc 600000 bc 320 eq 0 6.5278 ms/op 2.5581 ms/op 2.55
forkChoice updateHead vc 600000 bc 1200 eq 0 4.4307 ms/op 2.8420 ms/op 1.56
forkChoice updateHead vc 600000 bc 7200 eq 0 4.7584 ms/op 3.0595 ms/op 1.56
forkChoice updateHead vc 600000 bc 64 eq 1000 13.227 ms/op 9.9796 ms/op 1.33
forkChoice updateHead vc 600000 bc 64 eq 10000 16.342 ms/op 9.9012 ms/op 1.65
forkChoice updateHead vc 600000 bc 64 eq 300000 54.394 ms/op 14.940 ms/op 3.64
computeDeltas 500000 validators 300 proto nodes 4.8289 ms/op 3.0890 ms/op 1.56
computeDeltas 500000 validators 1200 proto nodes 5.2111 ms/op 3.0434 ms/op 1.71
computeDeltas 500000 validators 7200 proto nodes 5.1999 ms/op 3.0467 ms/op 1.71
computeDeltas 750000 validators 300 proto nodes 7.5898 ms/op 4.5261 ms/op 1.68
computeDeltas 750000 validators 1200 proto nodes 8.0191 ms/op 4.4260 ms/op 1.81
computeDeltas 750000 validators 7200 proto nodes 8.1549 ms/op 4.4901 ms/op 1.82
computeDeltas 1400000 validators 300 proto nodes 15.453 ms/op 8.2628 ms/op 1.87
computeDeltas 1400000 validators 1200 proto nodes 14.074 ms/op 8.2919 ms/op 1.70
computeDeltas 1400000 validators 7200 proto nodes 13.339 ms/op 8.3735 ms/op 1.59
computeDeltas 2100000 validators 300 proto nodes 17.514 ms/op 12.666 ms/op 1.38
computeDeltas 2100000 validators 1200 proto nodes 17.890 ms/op 12.695 ms/op 1.41
computeDeltas 2100000 validators 7200 proto nodes 17.951 ms/op 12.571 ms/op 1.43
altair processAttestation - 250000 vs - 7PWei normalcase 2.7361 ms/op 1.5015 ms/op 1.82
altair processAttestation - 250000 vs - 7PWei worstcase 3.9267 ms/op 2.2098 ms/op 1.78
altair processAttestation - setStatus - 1/6 committees join 122.84 us/op 68.543 us/op 1.79
altair processAttestation - setStatus - 1/3 committees join 207.86 us/op 134.25 us/op 1.55
altair processAttestation - setStatus - 1/2 committees join 290.07 us/op 204.50 us/op 1.42
altair processAttestation - setStatus - 2/3 committees join 399.99 us/op 269.65 us/op 1.48
altair processAttestation - setStatus - 4/5 committees join 570.04 us/op 376.97 us/op 1.51
altair processAttestation - setStatus - 100% committees join 662.97 us/op 463.34 us/op 1.43
altair processBlock - 250000 vs - 7PWei normalcase 6.7566 ms/op 3.5437 ms/op 1.91
altair processBlock - 250000 vs - 7PWei normalcase hashState 32.328 ms/op 27.823 ms/op 1.16
altair processBlock - 250000 vs - 7PWei worstcase 43.510 ms/op 39.898 ms/op 1.09
altair processBlock - 250000 vs - 7PWei worstcase hashState 89.783 ms/op 72.110 ms/op 1.25
phase0 processBlock - 250000 vs - 7PWei normalcase 3.0639 ms/op 1.8254 ms/op 1.68
phase0 processBlock - 250000 vs - 7PWei worstcase 31.659 ms/op 20.111 ms/op 1.57
altair processEth1Data - 250000 vs - 7PWei normalcase 561.43 us/op 241.68 us/op 2.32
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 9.5430 us/op 4.3210 us/op 2.21
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 56.370 us/op 34.285 us/op 1.64
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 15.152 us/op 7.4310 us/op 2.04
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.6260 us/op 4.7450 us/op 1.82
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 180.43 us/op 70.370 us/op 2.56
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.4344 ms/op 867.71 us/op 1.65
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.9414 ms/op 1.1992 ms/op 1.62
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.9486 ms/op 1.0590 ms/op 1.84
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.0544 ms/op 2.8587 ms/op 1.42
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0046 ms/op 1.1167 ms/op 1.80
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.5218 ms/op 2.9960 ms/op 1.51
Tree 40 250000 create 347.14 ms/op 174.53 ms/op 1.99
Tree 40 250000 get(125000) 173.77 ns/op 114.77 ns/op 1.51
Tree 40 250000 set(125000) 946.53 ns/op 515.59 ns/op 1.84
Tree 40 250000 toArray() 23.282 ms/op 9.6267 ms/op 2.42
Tree 40 250000 iterate all - toArray() + loop 23.049 ms/op 9.7134 ms/op 2.37
Tree 40 250000 iterate all - get(i) 64.462 ms/op 40.413 ms/op 1.60
Array 250000 create 4.2665 ms/op 2.2617 ms/op 1.89
Array 250000 clone - spread 1.7192 ms/op 1.2170 ms/op 1.41
Array 250000 get(125000) 0.46900 ns/op 0.58100 ns/op 0.81
Array 250000 set(125000) 0.52000 ns/op 0.58000 ns/op 0.90
Array 250000 iterate all - loop 91.059 us/op 76.986 us/op 1.18
phase0 afterProcessEpoch - 250000 vs - 7PWei 101.32 ms/op 70.964 ms/op 1.43
Array.fill - length 1000000 4.5656 ms/op 2.4101 ms/op 1.89
Array push - length 1000000 23.820 ms/op 14.403 ms/op 1.65
Array.get 0.30310 ns/op 0.26625 ns/op 1.14
Uint8Array.get 0.47585 ns/op 0.34479 ns/op 1.38
phase0 beforeProcessEpoch - 250000 vs - 7PWei 17.392 ms/op 11.825 ms/op 1.47
altair processEpoch - mainnet_e81889 367.77 ms/op 308.53 ms/op 1.19
mainnet_e81889 - altair beforeProcessEpoch 19.745 ms/op 15.658 ms/op 1.26
mainnet_e81889 - altair processJustificationAndFinalization 16.286 us/op 10.567 us/op 1.54
mainnet_e81889 - altair processInactivityUpdates 7.7649 ms/op 4.2792 ms/op 1.81
mainnet_e81889 - altair processRewardsAndPenalties 50.248 ms/op 57.024 ms/op 0.88
mainnet_e81889 - altair processRegistryUpdates 2.0880 us/op 1.9050 us/op 1.10
mainnet_e81889 - altair processSlashings 483.00 ns/op 736.00 ns/op 0.66
mainnet_e81889 - altair processEth1DataReset 421.00 ns/op 722.00 ns/op 0.58
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.8750 ms/op 1.6638 ms/op 1.13
mainnet_e81889 - altair processSlashingsReset 6.7570 us/op 2.1850 us/op 3.09
mainnet_e81889 - altair processRandaoMixesReset 3.7400 us/op 2.6210 us/op 1.43
mainnet_e81889 - altair processHistoricalRootsUpdate 822.00 ns/op 679.00 ns/op 1.21
mainnet_e81889 - altair processParticipationFlagUpdates 5.3350 us/op 1.5260 us/op 3.50
mainnet_e81889 - altair processSyncCommitteeUpdates 589.00 ns/op 732.00 ns/op 0.80
mainnet_e81889 - altair afterProcessEpoch 105.77 ms/op 79.347 ms/op 1.33
capella processEpoch - mainnet_e217614 1.4142 s/op 1.0650 s/op 1.33
mainnet_e217614 - capella beforeProcessEpoch 83.660 ms/op 73.898 ms/op 1.13
mainnet_e217614 - capella processJustificationAndFinalization 31.195 us/op 9.5830 us/op 3.26
mainnet_e217614 - capella processInactivityUpdates 22.934 ms/op 12.801 ms/op 1.79
mainnet_e217614 - capella processRewardsAndPenalties 278.97 ms/op 251.61 ms/op 1.11
mainnet_e217614 - capella processRegistryUpdates 16.247 us/op 11.022 us/op 1.47
mainnet_e217614 - capella processSlashings 785.00 ns/op 725.00 ns/op 1.08
mainnet_e217614 - capella processEth1DataReset 451.00 ns/op 614.00 ns/op 0.73
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.8768 ms/op 4.3680 ms/op 1.12
mainnet_e217614 - capella processSlashingsReset 4.9020 us/op 4.7780 us/op 1.03
mainnet_e217614 - capella processRandaoMixesReset 12.448 us/op 3.4660 us/op 3.59
mainnet_e217614 - capella processHistoricalRootsUpdate 1.0340 us/op 766.00 ns/op 1.35
mainnet_e217614 - capella processParticipationFlagUpdates 5.0150 us/op 1.7590 us/op 2.85
mainnet_e217614 - capella afterProcessEpoch 262.10 ms/op 195.33 ms/op 1.34
phase0 processEpoch - mainnet_e58758 477.41 ms/op 399.38 ms/op 1.20
mainnet_e58758 - phase0 beforeProcessEpoch 127.63 ms/op 72.791 ms/op 1.75
mainnet_e58758 - phase0 processJustificationAndFinalization 24.784 us/op 15.073 us/op 1.64
mainnet_e58758 - phase0 processRewardsAndPenalties 41.314 ms/op 33.114 ms/op 1.25
mainnet_e58758 - phase0 processRegistryUpdates 14.733 us/op 6.8990 us/op 2.14
mainnet_e58758 - phase0 processSlashings 608.00 ns/op 704.00 ns/op 0.86
mainnet_e58758 - phase0 processEth1DataReset 925.00 ns/op 755.00 ns/op 1.23
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.5885 ms/op 1.3655 ms/op 1.16
mainnet_e58758 - phase0 processSlashingsReset 5.3630 us/op 2.0330 us/op 2.64
mainnet_e58758 - phase0 processRandaoMixesReset 11.687 us/op 3.6230 us/op 3.23
mainnet_e58758 - phase0 processHistoricalRootsUpdate 835.00 ns/op 826.00 ns/op 1.01
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.7230 us/op 2.8890 us/op 1.63
mainnet_e58758 - phase0 afterProcessEpoch 89.070 ms/op 65.442 ms/op 1.36
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.5634 ms/op 977.72 us/op 1.60
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 4.7416 ms/op 1.7514 ms/op 2.71
altair processInactivityUpdates - 250000 normalcase 21.162 ms/op 17.481 ms/op 1.21
altair processInactivityUpdates - 250000 worstcase 22.735 ms/op 17.136 ms/op 1.33
phase0 processRegistryUpdates - 250000 normalcase 12.075 us/op 5.2560 us/op 2.30
phase0 processRegistryUpdates - 250000 badcase_full_deposits 451.99 us/op 293.60 us/op 1.54
phase0 processRegistryUpdates - 250000 worstcase 0.5 146.66 ms/op 116.37 ms/op 1.26
altair processRewardsAndPenalties - 250000 normalcase 43.106 ms/op 39.829 ms/op 1.08
altair processRewardsAndPenalties - 250000 worstcase 40.081 ms/op 47.642 ms/op 0.84
phase0 getAttestationDeltas - 250000 normalcase 9.5111 ms/op 6.1166 ms/op 1.55
phase0 getAttestationDeltas - 250000 worstcase 10.098 ms/op 5.8779 ms/op 1.72
phase0 processSlashings - 250000 worstcase 116.10 us/op 90.370 us/op 1.28
altair processSyncCommitteeUpdates - 250000 147.37 ms/op 91.930 ms/op 1.60
BeaconState.hashTreeRoot - No change 467.00 ns/op 456.00 ns/op 1.02
BeaconState.hashTreeRoot - 1 full validator 125.06 us/op 70.438 us/op 1.78
BeaconState.hashTreeRoot - 32 full validator 1.5454 ms/op 820.55 us/op 1.88
BeaconState.hashTreeRoot - 512 full validator 16.483 ms/op 7.9280 ms/op 2.08
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 193.84 us/op 113.76 us/op 1.70
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.4090 ms/op 1.6247 ms/op 1.48
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 30.200 ms/op 26.554 ms/op 1.14
BeaconState.hashTreeRoot - 1 balances 124.12 us/op 101.13 us/op 1.23
BeaconState.hashTreeRoot - 32 balances 1.0909 ms/op 966.78 us/op 1.13
BeaconState.hashTreeRoot - 512 balances 14.989 ms/op 9.4299 ms/op 1.59
BeaconState.hashTreeRoot - 250000 balances 230.02 ms/op 144.71 ms/op 1.59
aggregationBits - 2048 els - zipIndexesInBitList 38.433 us/op 19.344 us/op 1.99
byteArrayEquals 32 63.530 ns/op 48.818 ns/op 1.30
Buffer.compare 32 18.959 ns/op 15.941 ns/op 1.19
byteArrayEquals 1024 1.8164 us/op 1.3054 us/op 1.39
Buffer.compare 1024 25.717 ns/op 24.186 ns/op 1.06
byteArrayEquals 16384 28.287 us/op 20.385 us/op 1.39
Buffer.compare 16384 258.32 ns/op 181.72 ns/op 1.42
byteArrayEquals 123687377 214.88 ms/op 152.69 ms/op 1.41
Buffer.compare 123687377 9.5230 ms/op 4.4149 ms/op 2.16
byteArrayEquals 32 - diff last byte 58.226 ns/op 45.964 ns/op 1.27
Buffer.compare 32 - diff last byte 19.241 ns/op 16.934 ns/op 1.14
byteArrayEquals 1024 - diff last byte 1.6865 us/op 1.3207 us/op 1.28
Buffer.compare 1024 - diff last byte 27.448 ns/op 23.784 ns/op 1.15
byteArrayEquals 16384 - diff last byte 27.891 us/op 21.004 us/op 1.33
Buffer.compare 16384 - diff last byte 231.50 ns/op 221.86 ns/op 1.04
byteArrayEquals 123687377 - diff last byte 214.28 ms/op 160.94 ms/op 1.33
Buffer.compare 123687377 - diff last byte 11.464 ms/op 7.6970 ms/op 1.49
byteArrayEquals 32 - random bytes 5.8100 ns/op 5.2940 ns/op 1.10
Buffer.compare 32 - random bytes 21.014 ns/op 16.156 ns/op 1.30
byteArrayEquals 1024 - random bytes 5.6630 ns/op 5.0470 ns/op 1.12
Buffer.compare 1024 - random bytes 19.001 ns/op 15.700 ns/op 1.21
byteArrayEquals 16384 - random bytes 5.5850 ns/op 5.0250 ns/op 1.11
Buffer.compare 16384 - random bytes 18.230 ns/op 15.638 ns/op 1.17
byteArrayEquals 123687377 - random bytes 6.9000 ns/op 7.9800 ns/op 0.86
Buffer.compare 123687377 - random bytes 19.950 ns/op 19.120 ns/op 1.04
regular array get 100000 times 43.316 us/op 31.751 us/op 1.36
wrappedArray get 100000 times 34.376 us/op 31.834 us/op 1.08
arrayWithProxy get 100000 times 14.108 ms/op 9.9966 ms/op 1.41
ssz.Root.equals 49.140 ns/op 41.589 ns/op 1.18
byteArrayEquals 47.581 ns/op 45.282 ns/op 1.05
Buffer.compare 11.010 ns/op 9.4820 ns/op 1.16
shuffle list - 16384 els 6.6033 ms/op 5.6583 ms/op 1.17
shuffle list - 250000 els 100.04 ms/op 88.041 ms/op 1.14
processSlot - 1 slots 16.605 us/op 17.929 us/op 0.93
processSlot - 32 slots 4.4642 ms/op 3.1840 ms/op 1.40
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.125 ms/op 40.039 ms/op 0.98
getCommitteeAssignments - req 1 vs - 250000 vc 2.2107 ms/op 1.7756 ms/op 1.25
getCommitteeAssignments - req 100 vs - 250000 vc 4.2783 ms/op 3.5258 ms/op 1.21
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6112 ms/op 3.8083 ms/op 1.21
findModifiedValidators - 10000 modified validators 305.38 ms/op 250.92 ms/op 1.22
findModifiedValidators - 1000 modified validators 181.82 ms/op 147.17 ms/op 1.24
findModifiedValidators - 100 modified validators 174.48 ms/op 160.94 ms/op 1.08
findModifiedValidators - 10 modified validators 162.93 ms/op 165.71 ms/op 0.98
findModifiedValidators - 1 modified validators 223.19 ms/op 136.54 ms/op 1.63
findModifiedValidators - no difference 249.43 ms/op 149.61 ms/op 1.67
compare ViewDUs 3.7424 s/op 3.4750 s/op 1.08
compare each validator Uint8Array 2.0691 s/op 1.2644 s/op 1.64
compare ViewDU to Uint8Array 1.3954 s/op 886.07 ms/op 1.57
migrate state 1000000 validators, 24 modified, 0 new 805.04 ms/op 570.66 ms/op 1.41
migrate state 1000000 validators, 1700 modified, 1000 new 1.0886 s/op 835.21 ms/op 1.30
migrate state 1000000 validators, 3400 modified, 2000 new 1.5026 s/op 1.0527 s/op 1.43
migrate state 1500000 validators, 24 modified, 0 new 877.39 ms/op 565.77 ms/op 1.55
migrate state 1500000 validators, 1700 modified, 1000 new 1.0731 s/op 842.88 ms/op 1.27
migrate state 1500000 validators, 3400 modified, 2000 new 1.2613 s/op 870.03 ms/op 1.45
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.2800 ns/op 6.2400 ns/op 0.85
state getBlockRootAtSlot - 250000 vs - 7PWei 896.08 ns/op 550.98 ns/op 1.63
computeProposers - vc 250000 9.5718 ms/op 5.7195 ms/op 1.67
computeEpochShuffling - vc 250000 103.19 ms/op 80.284 ms/op 1.29
getNextSyncCommittee - vc 250000 149.48 ms/op 107.50 ms/op 1.39
computeSigningRoot for AttestationData 23.708 us/op 18.875 us/op 1.26
hash AttestationData serialized data then Buffer.toString(base64) 1.6854 us/op 1.2146 us/op 1.39
toHexString serialized data 1.1045 us/op 770.54 ns/op 1.43
Buffer.toString(base64) 219.12 ns/op 138.09 ns/op 1.59
nodejs block root to RootHex using toHex 179.78 ns/op 107.23 ns/op 1.68
nodejs block root to RootHex using toRootHex 121.23 ns/op 74.605 ns/op 1.62
browser block root to RootHex using the deprecated toHexString 289.39 ns/op 203.33 ns/op 1.42
browser block root to RootHex using toHex 241.35 ns/op 187.61 ns/op 1.29
browser block root to RootHex using toRootHex 192.57 ns/op 150.50 ns/op 1.28

Please sign in to comment.