Skip to content

Commit

Permalink
chore: upgrade to js-libp2p 2.0 (#7077)
Browse files Browse the repository at this point in the history
* chore: upgrade to js-libp2p 2.0

* chore: bump libp2p versions

* chore: fix up yarn lock

* chore: fix some tests

* chore: fix connection map

* feat: gossipsub v1.2

* chore: bump libp2p

* chore: tweak idontwantMinDataSize

* chore: bump libp2p deps
  • Loading branch information
wemeetagain authored Oct 11, 2024
1 parent 911a3f5 commit d37bdb0
Show file tree
Hide file tree
Showing 41 changed files with 754 additions and 599 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"https-browserify": "^1.0.0",
"jsdom": "^23.0.1",
"lerna": "^7.3.0",
"libp2p": "1.4.3",
"libp2p": "2.1.7",
"mocha": "^10.2.0",
"node-gyp": "^9.4.0",
"npm-run-all": "^4.1.5",
Expand Down
35 changes: 17 additions & 18 deletions packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@
"dependencies": {
"@chainsafe/as-sha256": "^0.5.0",
"@chainsafe/blst": "^2.0.3",
"@chainsafe/discv5": "^9.0.0",
"@chainsafe/enr": "^3.0.0",
"@chainsafe/libp2p-gossipsub": "^13.0.0",
"@chainsafe/libp2p-identify": "^1.0.0",
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/discv5": "^10.0.1",
"@chainsafe/enr": "^4.0.1",
"@chainsafe/libp2p-gossipsub": "^14.1.0",
"@chainsafe/libp2p-noise": "^16.0.0",
"@chainsafe/persistent-merkle-tree": "^0.8.0",
"@chainsafe/prometheus-gc-stats": "^1.0.0",
"@chainsafe/ssz": "^0.17.1",
Expand All @@ -111,15 +110,15 @@
"@fastify/cors": "^10.0.1",
"@fastify/swagger": "^9.0.0",
"@fastify/swagger-ui": "^5.0.1",
"@libp2p/bootstrap": "^10.0.21",
"@libp2p/identify": "^1.0.20",
"@libp2p/interface": "^1.3.0",
"@libp2p/mdns": "^10.0.21",
"@libp2p/mplex": "^10.0.21",
"@libp2p/peer-id": "^4.1.0",
"@libp2p/peer-id-factory": "^4.1.0",
"@libp2p/prometheus-metrics": "^3.0.21",
"@libp2p/tcp": "9.0.23",
"@libp2p/bootstrap": "^11.0.4",
"@libp2p/crypto": "^5.0.4",
"@libp2p/identify": "^3.0.4",
"@libp2p/interface": "^2.1.2",
"@libp2p/mdns": "^11.0.4",
"@libp2p/mplex": "^11.0.4",
"@libp2p/peer-id": "^5.0.4",
"@libp2p/prometheus-metrics": "^4.1.2",
"@libp2p/tcp": "10.0.4",
"@lodestar/api": "^1.22.0",
"@lodestar/config": "^1.22.0",
"@lodestar/db": "^1.22.0",
Expand All @@ -134,15 +133,15 @@
"@lodestar/validator": "^1.22.0",
"@multiformats/multiaddr": "^12.1.3",
"c-kzg": "^2.1.2",
"datastore-core": "^9.1.1",
"datastore-level": "^10.1.1",
"datastore-core": "^10.0.0",
"datastore-level": "^11.0.0",
"deepmerge": "^4.3.1",
"fastify": "^5.0.0",
"interface-datastore": "^8.2.7",
"interface-datastore": "^8.3.0",
"it-all": "^3.0.4",
"it-pipe": "^3.0.1",
"jwt-simple": "0.5.6",
"libp2p": "1.4.3",
"libp2p": "2.1.7",
"multiformats": "^11.0.1",
"prom-client": "^15.1.0",
"qs": "^6.11.1",
Expand Down
17 changes: 11 additions & 6 deletions packages/beacon-node/src/network/core/networkCore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Connection, PeerId} from "@libp2p/interface";
import {Connection, PrivateKey} from "@libp2p/interface";
import {multiaddr} from "@multiformats/multiaddr";
import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types";
import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js";
Expand Down Expand Up @@ -55,7 +55,7 @@ type Mods = {
export type BaseNetworkInit = {
opts: NetworkOptions;
config: BeaconConfig;
peerId: PeerId;
privateKey: PrivateKey;
peerStoreDir: string | undefined;
logger: LoggerNode;
metricsRegistry: RegistryMetricCreator | null;
Expand Down Expand Up @@ -126,7 +126,7 @@ export class NetworkCore implements INetworkCore {
static async init({
opts,
config,
peerId,
privateKey,
peerStoreDir,
logger,
metricsRegistry,
Expand All @@ -136,7 +136,7 @@ export class NetworkCore implements INetworkCore {
activeValidatorCount,
initialStatus,
}: BaseNetworkInit): Promise<NetworkCore> {
const libp2p = await createNodeJsLibp2p(peerId, opts, {
const libp2p = await createNodeJsLibp2p(privateKey, opts, {
peerStoreDir,
metrics: Boolean(metricsRegistry),
metricsRegistry: metricsRegistry ?? undefined,
Expand Down Expand Up @@ -200,8 +200,9 @@ export class NetworkCore implements INetworkCore {

const peerManager = await PeerManager.init(
{
privateKey,
libp2p,
gossip: gossip,
gossip,
reqResp,
attnetsService,
syncnetsService,
Expand Down Expand Up @@ -359,7 +360,11 @@ export class NetworkCore implements INetworkCore {
}

getConnectionsByPeer(): Map<string, Connection[]> {
return getConnectionsMap(this.libp2p);
const m = new Map<string, Connection[]>();
for (const [k, v] of getConnectionsMap(this.libp2p).entries()) {
m.set(k, v.value);
}
return m;
}

async getConnectedPeers(): Promise<PeerIdStr[]> {
Expand Down
8 changes: 5 additions & 3 deletions packages/beacon-node/src/network/core/networkCoreWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import path from "node:path";
import worker from "node:worker_threads";
import type {ModuleThread} from "@chainsafe/threads";
import {expose} from "@chainsafe/threads/worker";
import {createFromProtobuf} from "@libp2p/peer-id-factory";
import {privateKeyFromProtobuf} from "@libp2p/crypto/keys";
import {peerIdFromPrivateKey} from "@libp2p/peer-id";
import {chainConfigFromJson, createBeaconConfig} from "@lodestar/config";
import {getNodeLogger} from "@lodestar/logger/node";
import {RegistryMetricCreator, collectNodeJSMetrics} from "../../metrics/index.js";
Expand Down Expand Up @@ -32,7 +33,8 @@ if (!workerData) throw Error("workerData must be defined");
if (!parentPort) throw Error("parentPort must be defined");

const config = createBeaconConfig(chainConfigFromJson(workerData.chainConfigJson), workerData.genesisValidatorsRoot);
const peerId = await createFromProtobuf(workerData.peerIdProto);
const privateKey = privateKeyFromProtobuf(workerData.privateKeyProto);
const peerId = peerIdFromPrivateKey(privateKey);

// TODO: Pass options from main thread for logging
// TODO: Logging won't be visible in file loggers
Expand Down Expand Up @@ -92,7 +94,7 @@ if (networkCoreWorkerMetrics) {
const core = await NetworkCore.init({
opts: workerData.opts,
config,
peerId,
privateKey,
peerStoreDir: workerData.peerStoreDir,
logger,
metricsRegistry: metricsRegister,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import workerThreads from "node:worker_threads";
import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js";
import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types";
import {ModuleThread, Thread, Worker, spawn} from "@chainsafe/threads";
import {PeerId, Secp256k1PeerId} from "@libp2p/interface";
import {exportToProtobuf} from "@libp2p/peer-id-factory";
import {PrivateKey} from "@libp2p/interface";
import {privateKeyToProtobuf} from "@libp2p/crypto/keys";
import {routes} from "@lodestar/api";
import {BeaconConfig, chainConfigToJson} from "@lodestar/config";
import type {LoggerNode} from "@lodestar/logger/node";
Expand Down Expand Up @@ -44,7 +44,7 @@ export type WorkerNetworkCoreInitModules = {
opts: WorkerNetworkCoreOpts;
config: BeaconConfig;
logger: LoggerNode;
peerId: PeerId;
privateKey: PrivateKey;
events: NetworkEventBus;
metrics: Metrics | null;
getReqRespHandler: GetReqRespHandlerFn;
Expand Down Expand Up @@ -103,14 +103,14 @@ export class WorkerNetworkCore implements INetworkCore {
}

static async init(modules: WorkerNetworkCoreInitModules): Promise<WorkerNetworkCore> {
const {opts, config, peerId} = modules;
const {opts, config, privateKey} = modules;
const {genesisTime, peerStoreDir, activeValidatorCount, localMultiaddrs, metricsEnabled, initialStatus} = opts;

const workerData: NetworkWorkerData = {
opts,
chainConfigJson: chainConfigToJson(config),
genesisValidatorsRoot: config.genesisValidatorsRoot,
peerIdProto: exportToProtobuf(peerId as Secp256k1PeerId),
privateKeyProto: privateKeyToProtobuf(privateKey),
localMultiaddrs,
metricsEnabled,
peerStoreDir,
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export type NetworkWorkerData = {
genesisTime: number;
activeValidatorCount: number;
initialStatus: phase0.Status;
peerIdProto: Uint8Array;
privateKeyProto: Uint8Array;
localMultiaddrs: string[];
metricsEnabled: boolean;
peerStoreDir?: string;
Expand Down
14 changes: 6 additions & 8 deletions packages/beacon-node/src/network/discv5/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import EventEmitter from "node:events";
import {PeerId, Secp256k1PeerId} from "@libp2p/interface";
import {privateKeyToProtobuf} from "@libp2p/crypto/keys";
import {PrivateKey} from "@libp2p/interface";
import {StrictEventEmitter} from "strict-event-emitter-types";
import {exportToProtobuf} from "@libp2p/peer-id-factory";
import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR} from "@chainsafe/enr";
import {ENR, ENRData, SignableENR} from "@chainsafe/enr";
import {spawn, Thread, Worker} from "@chainsafe/threads";
import {chainConfigFromJson, chainConfigToJson, BeaconConfig} from "@lodestar/config";
import {LoggerNode} from "@lodestar/logger/node";
import {NetworkCoreMetrics} from "../core/metrics.js";
import {Discv5WorkerApi, Discv5WorkerData, LodestarDiscv5Opts} from "./types.js";

export type Discv5Opts = {
peerId: PeerId;
privateKey: PrivateKey;
discv5: LodestarDiscv5Opts;
logger: LoggerNode;
config: BeaconConfig;
Expand All @@ -25,7 +25,6 @@ export type Discv5Events = {
* Wrapper class abstracting the details of discv5 worker instantiation and message-passing
*/
export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<EventEmitter, Discv5Events>}) {
private readonly keypair;
private readonly subscription: {unsubscribe: () => void};
private closed = false;

Expand All @@ -35,14 +34,13 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<E
) {
super();

this.keypair = createPrivateKeyFromPeerId(this.opts.peerId);
this.subscription = workerApi.discovered().subscribe((enrObj) => this.onDiscovered(enrObj));
}

static async init(opts: Discv5Opts): Promise<Discv5Worker> {
const workerData: Discv5WorkerData = {
enr: opts.discv5.enr,
peerIdProto: exportToProtobuf(opts.peerId as Secp256k1PeerId),
privateKeyProto: privateKeyToProtobuf(opts.privateKey),
bindAddrs: opts.discv5.bindAddrs,
config: opts.discv5.config ?? {},
bootEnrs: opts.discv5.bootEnrs,
Expand Down Expand Up @@ -80,7 +78,7 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<E

async enr(): Promise<SignableENR> {
const obj = await this.workerApi.enr();
return new SignableENR(obj.kvs, obj.seq, this.keypair.privateKey);
return new SignableENR(obj.kvs, obj.seq, this.opts.privateKey.raw);
}

setEnrValue(key: string, value: Uint8Array): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/discv5/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type LodestarDiscv5Opts = {
/** discv5 worker constructor data */
export interface Discv5WorkerData {
enr: string;
peerIdProto: Uint8Array;
privateKeyProto: Uint8Array;
bindAddrs: BindAddrs;
config: Discv5Config;
bootEnrs: string[];
Expand Down
13 changes: 7 additions & 6 deletions packages/beacon-node/src/network/discv5/worker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import worker from "node:worker_threads";
import path from "node:path";
import fs from "node:fs";
import {createFromProtobuf} from "@libp2p/peer-id-factory";
import {Multiaddr, multiaddr} from "@multiformats/multiaddr";
import {expose} from "@chainsafe/threads/worker";
import {Observable, Subject} from "@chainsafe/threads/observable";
import {Discv5} from "@chainsafe/discv5";
import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR, SignableENRData} from "@chainsafe/enr";
import {ENR, ENRData, SignableENR, SignableENRData} from "@chainsafe/enr";
import {privateKeyFromProtobuf} from "@libp2p/crypto/keys";
import {peerIdFromPrivateKey} from "@libp2p/peer-id";
import {createBeaconConfig} from "@lodestar/config";
import {getNodeLogger} from "@lodestar/logger/node";
import {Gauge} from "@lodestar/utils";
Expand Down Expand Up @@ -42,15 +43,15 @@ if (workerData.metrics) {
});
}

const peerId = await createFromProtobuf(workerData.peerIdProto);
const keypair = createPrivateKeyFromPeerId(peerId);
const privateKey = privateKeyFromProtobuf(workerData.privateKeyProto);
const peerId = peerIdFromPrivateKey(privateKey);

const config = createBeaconConfig(workerData.chainConfig, workerData.genesisValidatorsRoot);

// Initialize discv5
const discv5 = Discv5.create({
enr: SignableENR.decodeTxt(workerData.enr, keypair.privateKey),
peerId,
enr: SignableENR.decodeTxt(workerData.enr, privateKey.raw),
privateKey,
bindAddrs: {
ip4: (workerData.bindAddrs.ip4 ? multiaddr(workerData.bindAddrs.ip4) : undefined) as Multiaddr,
ip6: workerData.bindAddrs.ip6 ? multiaddr(workerData.bindAddrs.ip6) : undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/beacon-node/src/network/gossip/gossipsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export class Eth2Gossipsub extends GossipSub {
// if this is false, only publish to mesh peers. If there is not enough GOSSIP_D mesh peers,
// publish to some more topic peers to make sure we always publish to at least GOSSIP_D peers
floodPublish: !opts?.disableFloodPublish,
// Only send IDONTWANT messages if the message size is larger than this
// This should be large enough to not send IDONTWANT for "small" messages
// See https://github.com/ChainSafe/lodestar/pull/7077#issuecomment-2383679472
idontwantMinDataSize: 16829,
});
this.scoreParams = scoreParams;
this.config = config;
Expand Down
4 changes: 3 additions & 1 deletion packages/beacon-node/src/network/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
PeerRouting,
PeerStore,
Upgrader,
PrivateKey,
} from "@libp2p/interface";
import type {AddressManager, ConnectionManager, Registrar, TransportManager} from "@libp2p/interface-internal";
import type {Datastore} from "interface-datastore";
import {Identify} from "@chainsafe/libp2p-identify";
import {Identify} from "@libp2p/identify";
import {
LightClientFinalityUpdate,
LightClientOptimisticUpdate,
Expand Down Expand Up @@ -93,6 +94,7 @@ export interface INetwork extends INetworkCorePublic {

export type LodestarComponents = {
peerId: PeerId;
privateKey: PrivateKey;
nodeInfo: NodeInfo;
logger: ComponentLogger;
events: TypedEventTarget<Libp2pEvents>;
Expand Down
21 changes: 10 additions & 11 deletions packages/beacon-node/src/network/libp2p/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {PeerId} from "@libp2p/interface";
import {PrivateKey} from "@libp2p/interface";
import {Registry} from "prom-client";
import {ENR} from "@chainsafe/enr";
// TODO: We should use this fork until https://github.com/libp2p/js-libp2p/pull/2387
import {identify} from "@chainsafe/libp2p-identify";
import {identify} from "@libp2p/identify";
import {bootstrap} from "@libp2p/bootstrap";
import {mdns} from "@libp2p/mdns";
import {createLibp2p} from "libp2p";
Expand Down Expand Up @@ -34,7 +33,7 @@ export async function getDiscv5Multiaddrs(bootEnrs: string[]): Promise<string[]>
}

export async function createNodeJsLibp2p(
peerId: PeerId,
privateKey: PrivateKey,
networkOpts: Partial<NetworkOptions> = {},
nodeJsLibp2pOpts: NodeJsLibp2pOpts = {}
): Promise<Libp2p> {
Expand Down Expand Up @@ -65,12 +64,12 @@ export async function createNodeJsLibp2p(
}

return createLibp2p({
peerId,
privateKey,
addresses: {
listen: localMultiaddrs,
announce: [],
},
connectionEncryption: [noise()],
connectionEncrypters: [noise()],
// Reject connections when the server's connection count gets high
transports: [
tcp({
Expand Down Expand Up @@ -99,15 +98,14 @@ export async function createNodeJsLibp2p(
maxParallelDials: 100,
maxPeerAddrsToDial: 4,
dialTimeout: 30_000,

// Rely entirely on lodestar's peer manager to prune connections
//maxConnections: options.maxConnections,
// DOCS: There is no way to turn off autodial other than setting minConnections to 0
minConnections: 0,
// the maximum number of pending connections libp2p will accept before it starts rejecting incoming connections.
// make it the same to backlog option above
maxIncomingPendingConnections: 5,
},
// rely on lodestar's peer manager to ping peers
connectionMonitor: {
enabled: false,
},
datastore,
services: {
identify: identify({
Expand All @@ -118,6 +116,7 @@ export async function createNodeJsLibp2p(
// and passing it here directly causes problems downstream, not to mention is slowwww
components: (components: LodestarComponents) => ({
peerId: components.peerId,
privateKey: components.privateKey,
nodeInfo: components.nodeInfo,
logger: components.logger,
events: components.events,
Expand Down
Loading

1 comment on commit d37bdb0

@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: d37bdb0 Previous: 911a3f5 Ratio
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 9.6080 ms/op 1.7120 ms/op 5.61
Full benchmark results
Benchmark suite Current: d37bdb0 Previous: 911a3f5 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.7476 ms/op 1.7522 ms/op 1.57
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 80.185 us/op 38.016 us/op 2.11
BLS verify - blst 1.0552 ms/op 873.62 us/op 1.21
BLS verifyMultipleSignatures 3 - blst 1.3518 ms/op 1.6566 ms/op 0.82
BLS verifyMultipleSignatures 8 - blst 1.9605 ms/op 2.0476 ms/op 0.96
BLS verifyMultipleSignatures 32 - blst 6.2975 ms/op 4.4356 ms/op 1.42
BLS verifyMultipleSignatures 64 - blst 11.041 ms/op 8.2255 ms/op 1.34
BLS verifyMultipleSignatures 128 - blst 18.654 ms/op 15.839 ms/op 1.18
BLS deserializing 10000 signatures 714.52 ms/op 615.70 ms/op 1.16
BLS deserializing 100000 signatures 6.9907 s/op 5.9199 s/op 1.18
BLS verifyMultipleSignatures - same message - 3 - blst 1.0918 ms/op 961.68 us/op 1.14
BLS verifyMultipleSignatures - same message - 8 - blst 1.0658 ms/op 1.0369 ms/op 1.03
BLS verifyMultipleSignatures - same message - 32 - blst 1.8954 ms/op 1.6362 ms/op 1.16
BLS verifyMultipleSignatures - same message - 64 - blst 2.7597 ms/op 2.4066 ms/op 1.15
BLS verifyMultipleSignatures - same message - 128 - blst 4.2411 ms/op 3.9490 ms/op 1.07
BLS aggregatePubkeys 32 - blst 19.168 us/op 16.937 us/op 1.13
BLS aggregatePubkeys 128 - blst 68.010 us/op 56.754 us/op 1.20
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 62.542 ms/op 62.198 ms/op 1.01
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 56.029 ms/op 46.469 ms/op 1.21
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 50.636 ms/op 36.970 ms/op 1.37
getSlashingsAndExits - default max 106.45 us/op 66.610 us/op 1.60
getSlashingsAndExits - 2k 323.09 us/op 272.53 us/op 1.19
proposeBlockBody type=full, size=empty 6.7640 ms/op 4.9282 ms/op 1.37
isKnown best case - 1 super set check 323.00 ns/op 563.00 ns/op 0.57
isKnown normal case - 2 super set checks 316.00 ns/op 518.00 ns/op 0.61
isKnown worse case - 16 super set checks 295.00 ns/op 606.00 ns/op 0.49
InMemoryCheckpointStateCache - add get delete 3.1890 us/op 3.0420 us/op 1.05
updateUnfinalizedPubkeys - updating 10 pubkeys 1.2347 ms/op 624.69 us/op 1.98
updateUnfinalizedPubkeys - updating 100 pubkeys 4.5262 ms/op 3.9740 ms/op 1.14
updateUnfinalizedPubkeys - updating 1000 pubkeys 59.492 ms/op 42.367 ms/op 1.40
validate api signedAggregateAndProof - struct 1.6519 ms/op 1.5249 ms/op 1.08
validate gossip signedAggregateAndProof - struct 1.5385 ms/op 1.4959 ms/op 1.03
batch validate gossip attestation - vc 640000 - chunk 32 139.66 us/op 130.80 us/op 1.07
batch validate gossip attestation - vc 640000 - chunk 64 120.66 us/op 118.91 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 128 117.95 us/op 105.55 us/op 1.12
batch validate gossip attestation - vc 640000 - chunk 256 113.67 us/op 104.67 us/op 1.09
pickEth1Vote - no votes 1.1652 ms/op 1.0102 ms/op 1.15
pickEth1Vote - max votes 7.8237 ms/op 5.2591 ms/op 1.49
pickEth1Vote - Eth1Data hashTreeRoot value x2048 16.307 ms/op 13.445 ms/op 1.21
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 23.186 ms/op 17.313 ms/op 1.34
pickEth1Vote - Eth1Data fastSerialize value x2048 496.62 us/op 380.14 us/op 1.31
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.2911 ms/op 3.5428 ms/op 1.21
bytes32 toHexString 546.00 ns/op 808.00 ns/op 0.68
bytes32 Buffer.toString(hex) 275.00 ns/op 519.00 ns/op 0.53
bytes32 Buffer.toString(hex) from Uint8Array 448.00 ns/op 606.00 ns/op 0.74
bytes32 Buffer.toString(hex) + 0x 272.00 ns/op 462.00 ns/op 0.59
Object access 1 prop 0.15100 ns/op 0.35300 ns/op 0.43
Map access 1 prop 0.14100 ns/op 0.34200 ns/op 0.41
Object get x1000 5.9910 ns/op 5.2740 ns/op 1.14
Map get x1000 6.4530 ns/op 5.9400 ns/op 1.09
Object set x1000 35.462 ns/op 24.273 ns/op 1.46
Map set x1000 25.028 ns/op 19.938 ns/op 1.26
Return object 10000 times 0.30060 ns/op 0.30700 ns/op 0.98
Throw Error 10000 times 3.4073 us/op 2.8528 us/op 1.19
toHex 171.69 ns/op 119.13 ns/op 1.44
Buffer.from 156.86 ns/op 107.22 ns/op 1.46
shared Buffer 96.247 ns/op 79.782 ns/op 1.21
fastMsgIdFn sha256 / 200 bytes 2.4180 us/op 2.2830 us/op 1.06
fastMsgIdFn h32 xxhash / 200 bytes 293.00 ns/op 523.00 ns/op 0.56
fastMsgIdFn h64 xxhash / 200 bytes 275.00 ns/op 477.00 ns/op 0.58
fastMsgIdFn sha256 / 1000 bytes 7.3230 us/op 6.0790 us/op 1.20
fastMsgIdFn h32 xxhash / 1000 bytes 416.00 ns/op 532.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 1000 bytes 356.00 ns/op 513.00 ns/op 0.69
fastMsgIdFn sha256 / 10000 bytes 64.942 us/op 50.135 us/op 1.30
fastMsgIdFn h32 xxhash / 10000 bytes 1.9460 us/op 1.9660 us/op 0.99
fastMsgIdFn h64 xxhash / 10000 bytes 1.2580 us/op 1.3810 us/op 0.91
send data - 1000 256B messages 14.210 ms/op 10.030 ms/op 1.42
send data - 1000 512B messages 18.034 ms/op 13.099 ms/op 1.38
send data - 1000 1024B messages 29.206 ms/op 22.857 ms/op 1.28
send data - 1000 1200B messages 28.542 ms/op 22.049 ms/op 1.29
send data - 1000 2048B messages 35.521 ms/op 28.851 ms/op 1.23
send data - 1000 4096B messages 33.970 ms/op 26.065 ms/op 1.30
send data - 1000 16384B messages 71.594 ms/op 65.392 ms/op 1.09
send data - 1000 65536B messages 246.28 ms/op 243.86 ms/op 1.01
enrSubnets - fastDeserialize 64 bits 1.1390 us/op 1.0900 us/op 1.04
enrSubnets - ssz BitVector 64 bits 378.00 ns/op 513.00 ns/op 0.74
enrSubnets - fastDeserialize 4 bits 194.00 ns/op 331.00 ns/op 0.59
enrSubnets - ssz BitVector 4 bits 413.00 ns/op 522.00 ns/op 0.79
prioritizePeers score -10:0 att 32-0.1 sync 2-0 195.59 us/op 149.39 us/op 1.31
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 173.41 us/op 137.31 us/op 1.26
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 347.48 us/op 280.89 us/op 1.24
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 514.41 us/op 441.47 us/op 1.17
prioritizePeers score 0:0 att 64-1 sync 4-1 934.25 us/op 758.52 us/op 1.23
array of 16000 items push then shift 1.6587 us/op 1.2551 us/op 1.32
LinkedList of 16000 items push then shift 7.5550 ns/op 7.6370 ns/op 0.99
array of 16000 items push then pop 145.47 ns/op 112.26 ns/op 1.30
LinkedList of 16000 items push then pop 7.4430 ns/op 6.3450 ns/op 1.17
array of 24000 items push then shift 2.4685 us/op 1.8350 us/op 1.35
LinkedList of 24000 items push then shift 7.7110 ns/op 7.1010 ns/op 1.09
array of 24000 items push then pop 145.96 ns/op 142.46 ns/op 1.02
LinkedList of 24000 items push then pop 7.7940 ns/op 6.1200 ns/op 1.27
intersect bitArray bitLen 8 6.6380 ns/op 5.2630 ns/op 1.26
intersect array and set length 8 47.909 ns/op 37.627 ns/op 1.27
intersect bitArray bitLen 128 29.394 ns/op 25.951 ns/op 1.13
intersect array and set length 128 687.80 ns/op 598.13 ns/op 1.15
bitArray.getTrueBitIndexes() bitLen 128 2.0120 us/op 2.3410 us/op 0.86
bitArray.getTrueBitIndexes() bitLen 248 3.8600 us/op 4.1280 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 512 8.1200 us/op 8.9380 us/op 0.91
Buffer.concat 32 items 932.00 ns/op 1.1070 us/op 0.84
Uint8Array.set 32 items 1.5410 us/op 1.8340 us/op 0.84
Buffer.copy 1.7400 us/op 1.8360 us/op 0.95
Uint8Array.set - with subarray 2.7380 us/op 2.4960 us/op 1.10
Uint8Array.set - without subarray 1.7480 us/op 1.5710 us/op 1.11
getUint32 - dataview 251.00 ns/op 418.00 ns/op 0.60
getUint32 - manual 162.00 ns/op 387.00 ns/op 0.42
Set add up to 64 items then delete first 2.2052 us/op 1.7240 us/op 1.28
OrderedSet add up to 64 items then delete first 3.2819 us/op 2.6932 us/op 1.22
Set add up to 64 items then delete last 2.5264 us/op 1.9701 us/op 1.28
OrderedSet add up to 64 items then delete last 3.7398 us/op 2.9308 us/op 1.28
Set add up to 64 items then delete middle 2.5254 us/op 2.1938 us/op 1.15
OrderedSet add up to 64 items then delete middle 5.2466 us/op 5.0593 us/op 1.04
Set add up to 128 items then delete first 5.0441 us/op 3.9706 us/op 1.27
OrderedSet add up to 128 items then delete first 7.8456 us/op 6.0892 us/op 1.29
Set add up to 128 items then delete last 4.9242 us/op 3.9692 us/op 1.24
OrderedSet add up to 128 items then delete last 7.3923 us/op 6.4132 us/op 1.15
Set add up to 128 items then delete middle 4.8184 us/op 4.0148 us/op 1.20
OrderedSet add up to 128 items then delete middle 13.760 us/op 12.533 us/op 1.10
Set add up to 256 items then delete first 10.572 us/op 8.0446 us/op 1.31
OrderedSet add up to 256 items then delete first 15.613 us/op 14.555 us/op 1.07
Set add up to 256 items then delete last 9.5145 us/op 9.0776 us/op 1.05
OrderedSet add up to 256 items then delete last 14.024 us/op 12.229 us/op 1.15
Set add up to 256 items then delete middle 9.3054 us/op 7.2354 us/op 1.29
OrderedSet add up to 256 items then delete middle 40.017 us/op 34.027 us/op 1.18
transfer serialized Status (84 B) 1.2670 us/op 1.3690 us/op 0.93
copy serialized Status (84 B) 1.0680 us/op 1.1730 us/op 0.91
transfer serialized SignedVoluntaryExit (112 B) 1.3450 us/op 1.3920 us/op 0.97
copy serialized SignedVoluntaryExit (112 B) 1.1390 us/op 1.1930 us/op 0.95
transfer serialized ProposerSlashing (416 B) 1.5160 us/op 1.6420 us/op 0.92
copy serialized ProposerSlashing (416 B) 1.9120 us/op 1.4090 us/op 1.36
transfer serialized Attestation (485 B) 1.8730 us/op 1.6880 us/op 1.11
copy serialized Attestation (485 B) 1.6680 us/op 1.5250 us/op 1.09
transfer serialized AttesterSlashing (33232 B) 2.5780 us/op 2.4210 us/op 1.06
copy serialized AttesterSlashing (33232 B) 4.9710 us/op 5.5900 us/op 0.89
transfer serialized Small SignedBeaconBlock (128000 B) 2.0860 us/op 2.5640 us/op 0.81
copy serialized Small SignedBeaconBlock (128000 B) 15.635 us/op 16.142 us/op 0.97
transfer serialized Avg SignedBeaconBlock (200000 B) 2.8540 us/op 3.5100 us/op 0.81
copy serialized Avg SignedBeaconBlock (200000 B) 20.508 us/op 22.224 us/op 0.92
transfer serialized BlobsSidecar (524380 B) 2.1800 us/op 3.6950 us/op 0.59
copy serialized BlobsSidecar (524380 B) 93.620 us/op 72.328 us/op 1.29
transfer serialized Big SignedBeaconBlock (1000000 B) 2.4690 us/op 3.8720 us/op 0.64
copy serialized Big SignedBeaconBlock (1000000 B) 154.68 us/op 130.80 us/op 1.18
pass gossip attestations to forkchoice per slot 2.7914 ms/op 2.4462 ms/op 1.14
forkChoice updateHead vc 100000 bc 64 eq 0 611.82 us/op 344.76 us/op 1.77
forkChoice updateHead vc 600000 bc 64 eq 0 3.5536 ms/op 2.3894 ms/op 1.49
forkChoice updateHead vc 1000000 bc 64 eq 0 4.7344 ms/op 3.9620 ms/op 1.19
forkChoice updateHead vc 600000 bc 320 eq 0 2.7598 ms/op 2.1681 ms/op 1.27
forkChoice updateHead vc 600000 bc 1200 eq 0 2.8303 ms/op 2.2504 ms/op 1.26
forkChoice updateHead vc 600000 bc 7200 eq 0 3.1648 ms/op 2.8550 ms/op 1.11
forkChoice updateHead vc 600000 bc 64 eq 1000 10.061 ms/op 9.0982 ms/op 1.11
forkChoice updateHead vc 600000 bc 64 eq 10000 10.509 ms/op 8.9695 ms/op 1.17
forkChoice updateHead vc 600000 bc 64 eq 300000 13.348 ms/op 11.648 ms/op 1.15
computeDeltas 500000 validators 300 proto nodes 3.9390 ms/op 3.2512 ms/op 1.21
computeDeltas 500000 validators 1200 proto nodes 4.0326 ms/op 3.1133 ms/op 1.30
computeDeltas 500000 validators 7200 proto nodes 3.9571 ms/op 3.2869 ms/op 1.20
computeDeltas 750000 validators 300 proto nodes 6.0330 ms/op 4.9934 ms/op 1.21
computeDeltas 750000 validators 1200 proto nodes 6.1541 ms/op 4.7989 ms/op 1.28
computeDeltas 750000 validators 7200 proto nodes 6.2275 ms/op 4.9392 ms/op 1.26
computeDeltas 1400000 validators 300 proto nodes 11.587 ms/op 12.490 ms/op 0.93
computeDeltas 1400000 validators 1200 proto nodes 11.649 ms/op 9.2919 ms/op 1.25
computeDeltas 1400000 validators 7200 proto nodes 11.614 ms/op 8.7886 ms/op 1.32
computeDeltas 2100000 validators 300 proto nodes 17.616 ms/op 13.629 ms/op 1.29
computeDeltas 2100000 validators 1200 proto nodes 17.409 ms/op 13.743 ms/op 1.27
computeDeltas 2100000 validators 7200 proto nodes 17.989 ms/op 13.507 ms/op 1.33
altair processAttestation - 250000 vs - 7PWei normalcase 1.6642 ms/op 1.3944 ms/op 1.19
altair processAttestation - 250000 vs - 7PWei worstcase 2.5261 ms/op 2.2352 ms/op 1.13
altair processAttestation - setStatus - 1/6 committees join 93.740 us/op 76.750 us/op 1.22
altair processAttestation - setStatus - 1/3 committees join 174.90 us/op 146.09 us/op 1.20
altair processAttestation - setStatus - 1/2 committees join 249.59 us/op 224.93 us/op 1.11
altair processAttestation - setStatus - 2/3 committees join 328.97 us/op 282.59 us/op 1.16
altair processAttestation - setStatus - 4/5 committees join 483.20 us/op 430.15 us/op 1.12
altair processAttestation - setStatus - 100% committees join 575.41 us/op 523.40 us/op 1.10
altair processBlock - 250000 vs - 7PWei normalcase 5.7144 ms/op 4.7954 ms/op 1.19
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.768 ms/op 32.303 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase 36.829 ms/op 35.084 ms/op 1.05
altair processBlock - 250000 vs - 7PWei worstcase hashState 73.998 ms/op 75.686 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei normalcase 2.4303 ms/op 1.5907 ms/op 1.53
phase0 processBlock - 250000 vs - 7PWei worstcase 25.598 ms/op 26.296 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 337.42 us/op 258.70 us/op 1.30
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.8120 us/op 7.1220 us/op 0.82
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 36.373 us/op 33.833 us/op 1.08
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.710 us/op 10.359 us/op 1.03
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.1860 us/op 7.3930 us/op 0.97
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 172.08 us/op 119.43 us/op 1.44
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.6278 ms/op 906.67 us/op 1.80
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.6714 ms/op 1.3025 ms/op 1.28
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.4420 ms/op 1.2460 ms/op 1.16
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.5320 ms/op 3.6136 ms/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1378 ms/op 1.6521 ms/op 1.29
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.7022 ms/op 3.2102 ms/op 1.15
Tree 40 250000 create 222.91 ms/op 203.25 ms/op 1.10
Tree 40 250000 get(125000) 155.08 ns/op 128.85 ns/op 1.20
Tree 40 250000 set(125000) 683.69 ns/op 584.25 ns/op 1.17
Tree 40 250000 toArray() 20.245 ms/op 16.894 ms/op 1.20
Tree 40 250000 iterate all - toArray() + loop 19.674 ms/op 16.381 ms/op 1.20
Tree 40 250000 iterate all - get(i) 55.397 ms/op 50.319 ms/op 1.10
Array 250000 create 2.8607 ms/op 2.6564 ms/op 1.08
Array 250000 clone - spread 1.4130 ms/op 1.3962 ms/op 1.01
Array 250000 get(125000) 0.42800 ns/op 0.61000 ns/op 0.70
Array 250000 set(125000) 0.44500 ns/op 0.61600 ns/op 0.72
Array 250000 iterate all - loop 84.961 us/op 78.478 us/op 1.08
phase0 afterProcessEpoch - 250000 vs - 7PWei 50.721 ms/op 44.019 ms/op 1.15
Array.fill - length 1000000 3.5051 ms/op 3.2751 ms/op 1.07
Array push - length 1000000 17.706 ms/op 22.056 ms/op 0.80
Array.get 0.27539 ns/op 0.27025 ns/op 1.02
Uint8Array.get 0.43945 ns/op 0.34418 ns/op 1.28
phase0 beforeProcessEpoch - 250000 vs - 7PWei 18.093 ms/op 22.333 ms/op 0.81
altair processEpoch - mainnet_e81889 278.19 ms/op 290.51 ms/op 0.96
mainnet_e81889 - altair beforeProcessEpoch 20.030 ms/op 22.255 ms/op 0.90
mainnet_e81889 - altair processJustificationAndFinalization 14.213 us/op 13.968 us/op 1.02
mainnet_e81889 - altair processInactivityUpdates 5.7311 ms/op 5.9485 ms/op 0.96
mainnet_e81889 - altair processRewardsAndPenalties 55.869 ms/op 51.988 ms/op 1.07
mainnet_e81889 - altair processRegistryUpdates 2.2930 us/op 2.9620 us/op 0.77
mainnet_e81889 - altair processSlashings 449.00 ns/op 723.00 ns/op 0.62
mainnet_e81889 - altair processEth1DataReset 773.00 ns/op 719.00 ns/op 1.08
mainnet_e81889 - altair processEffectiveBalanceUpdates 3.2627 ms/op 1.0608 ms/op 3.08
mainnet_e81889 - altair processSlashingsReset 10.908 us/op 3.3700 us/op 3.24
mainnet_e81889 - altair processRandaoMixesReset 7.4220 us/op 4.2550 us/op 1.74
mainnet_e81889 - altair processHistoricalRootsUpdate 1.7530 us/op 874.00 ns/op 2.01
mainnet_e81889 - altair processParticipationFlagUpdates 8.6660 us/op 2.1920 us/op 3.95
mainnet_e81889 - altair processSyncCommitteeUpdates 1.6530 us/op 918.00 ns/op 1.80
mainnet_e81889 - altair afterProcessEpoch 58.071 ms/op 43.746 ms/op 1.33
capella processEpoch - mainnet_e217614 1.5775 s/op 917.93 ms/op 1.72
mainnet_e217614 - capella beforeProcessEpoch 151.79 ms/op 68.697 ms/op 2.21
mainnet_e217614 - capella processJustificationAndFinalization 43.174 us/op 10.164 us/op 4.25
mainnet_e217614 - capella processInactivityUpdates 34.807 ms/op 12.320 ms/op 2.83
mainnet_e217614 - capella processRewardsAndPenalties 354.85 ms/op 253.91 ms/op 1.40
mainnet_e217614 - capella processRegistryUpdates 31.060 us/op 10.807 us/op 2.87
mainnet_e217614 - capella processSlashings 668.00 ns/op 734.00 ns/op 0.91
mainnet_e217614 - capella processEth1DataReset 575.00 ns/op 738.00 ns/op 0.78
mainnet_e217614 - capella processEffectiveBalanceUpdates 12.854 ms/op 18.264 ms/op 0.70
mainnet_e217614 - capella processSlashingsReset 3.5150 us/op 2.6510 us/op 1.33
mainnet_e217614 - capella processRandaoMixesReset 3.6510 us/op 4.6330 us/op 0.79
mainnet_e217614 - capella processHistoricalRootsUpdate 2.0300 us/op 703.00 ns/op 2.89
mainnet_e217614 - capella processParticipationFlagUpdates 7.9960 us/op 3.4970 us/op 2.29
mainnet_e217614 - capella afterProcessEpoch 142.00 ms/op 101.49 ms/op 1.40
phase0 processEpoch - mainnet_e58758 343.46 ms/op 258.46 ms/op 1.33
mainnet_e58758 - phase0 beforeProcessEpoch 102.09 ms/op 83.738 ms/op 1.22
mainnet_e58758 - phase0 processJustificationAndFinalization 37.066 us/op 14.069 us/op 2.63
mainnet_e58758 - phase0 processRewardsAndPenalties 48.583 ms/op 26.689 ms/op 1.82
mainnet_e58758 - phase0 processRegistryUpdates 16.297 us/op 6.7470 us/op 2.42
mainnet_e58758 - phase0 processSlashings 789.00 ns/op 806.00 ns/op 0.98
mainnet_e58758 - phase0 processEth1DataReset 1.5690 us/op 684.00 ns/op 2.29
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.9013 ms/op 1.3646 ms/op 1.39
mainnet_e58758 - phase0 processSlashingsReset 3.4600 us/op 3.6600 us/op 0.95
mainnet_e58758 - phase0 processRandaoMixesReset 5.2280 us/op 4.4020 us/op 1.19
mainnet_e58758 - phase0 processHistoricalRootsUpdate 845.00 ns/op 677.00 ns/op 1.25
mainnet_e58758 - phase0 processParticipationRecordUpdates 7.9580 us/op 4.0880 us/op 1.95
mainnet_e58758 - phase0 afterProcessEpoch 49.276 ms/op 34.813 ms/op 1.42
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.4720 ms/op 1.4619 ms/op 1.69
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 9.6080 ms/op 1.7120 ms/op 5.61
altair processInactivityUpdates - 250000 normalcase 33.898 ms/op 17.074 ms/op 1.99
altair processInactivityUpdates - 250000 worstcase 29.788 ms/op 16.145 ms/op 1.85
phase0 processRegistryUpdates - 250000 normalcase 17.230 us/op 2.6660 us/op 6.46
phase0 processRegistryUpdates - 250000 badcase_full_deposits 425.31 us/op 310.69 us/op 1.37
phase0 processRegistryUpdates - 250000 worstcase 0.5 131.11 ms/op 110.05 ms/op 1.19
altair processRewardsAndPenalties - 250000 normalcase 51.527 ms/op 41.477 ms/op 1.24
altair processRewardsAndPenalties - 250000 worstcase 61.038 ms/op 42.280 ms/op 1.44
phase0 getAttestationDeltas - 250000 normalcase 7.6217 ms/op 4.9697 ms/op 1.53
phase0 getAttestationDeltas - 250000 worstcase 7.3581 ms/op 5.1658 ms/op 1.42
phase0 processSlashings - 250000 worstcase 126.23 us/op 81.572 us/op 1.55
altair processSyncCommitteeUpdates - 250000 127.70 ms/op 102.52 ms/op 1.25
BeaconState.hashTreeRoot - No change 236.00 ns/op 456.00 ns/op 0.52
BeaconState.hashTreeRoot - 1 full validator 122.71 us/op 145.01 us/op 0.85
BeaconState.hashTreeRoot - 32 full validator 1.0481 ms/op 1.5140 ms/op 0.69
BeaconState.hashTreeRoot - 512 full validator 15.550 ms/op 8.8166 ms/op 1.76
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 185.88 us/op 142.00 us/op 1.31
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.7515 ms/op 1.1149 ms/op 2.47
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 41.677 ms/op 15.414 ms/op 2.70
BeaconState.hashTreeRoot - 1 balances 146.63 us/op 91.662 us/op 1.60
BeaconState.hashTreeRoot - 32 balances 1.2319 ms/op 904.02 us/op 1.36
BeaconState.hashTreeRoot - 512 balances 12.863 ms/op 6.0233 ms/op 2.14
BeaconState.hashTreeRoot - 250000 balances 170.05 ms/op 127.99 ms/op 1.33
aggregationBits - 2048 els - zipIndexesInBitList 38.825 us/op 19.241 us/op 2.02
byteArrayEquals 32 58.570 ns/op 48.309 ns/op 1.21
Buffer.compare 32 18.470 ns/op 15.706 ns/op 1.18
byteArrayEquals 1024 1.6357 us/op 1.2671 us/op 1.29
Buffer.compare 1024 26.619 ns/op 24.456 ns/op 1.09
byteArrayEquals 16384 27.011 us/op 20.132 us/op 1.34
Buffer.compare 16384 229.47 ns/op 202.80 ns/op 1.13
byteArrayEquals 123687377 195.33 ms/op 150.65 ms/op 1.30
Buffer.compare 123687377 7.0265 ms/op 4.2525 ms/op 1.65
byteArrayEquals 32 - diff last byte 54.081 ns/op 46.883 ns/op 1.15
Buffer.compare 32 - diff last byte 18.651 ns/op 15.967 ns/op 1.17
byteArrayEquals 1024 - diff last byte 1.6322 us/op 1.2547 us/op 1.30
Buffer.compare 1024 - diff last byte 27.193 ns/op 24.070 ns/op 1.13
byteArrayEquals 16384 - diff last byte 25.724 us/op 19.980 us/op 1.29
Buffer.compare 16384 - diff last byte 209.10 ns/op 205.64 ns/op 1.02
byteArrayEquals 123687377 - diff last byte 191.05 ms/op 148.95 ms/op 1.28
Buffer.compare 123687377 - diff last byte 6.4105 ms/op 4.8610 ms/op 1.32
byteArrayEquals 32 - random bytes 5.1820 ns/op 4.9610 ns/op 1.04
Buffer.compare 32 - random bytes 16.991 ns/op 16.401 ns/op 1.04
byteArrayEquals 1024 - random bytes 5.1550 ns/op 4.9120 ns/op 1.05
Buffer.compare 1024 - random bytes 17.005 ns/op 16.210 ns/op 1.05
byteArrayEquals 16384 - random bytes 5.1230 ns/op 4.9210 ns/op 1.04
Buffer.compare 16384 - random bytes 17.005 ns/op 16.185 ns/op 1.05
byteArrayEquals 123687377 - random bytes 6.4900 ns/op 7.9600 ns/op 0.82
Buffer.compare 123687377 - random bytes 18.330 ns/op 19.640 ns/op 0.93
regular array get 100000 times 34.921 us/op 31.662 us/op 1.10
wrappedArray get 100000 times 33.041 us/op 31.378 us/op 1.05
arrayWithProxy get 100000 times 13.143 ms/op 9.9007 ms/op 1.33
ssz.Root.equals 46.250 ns/op 44.333 ns/op 1.04
byteArrayEquals 45.401 ns/op 43.800 ns/op 1.04
Buffer.compare 10.449 ns/op 9.3790 ns/op 1.11
processSlot - 1 slots 18.034 us/op 10.034 us/op 1.80
processSlot - 32 slots 3.0447 ms/op 1.7892 ms/op 1.70
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 41.504 ms/op 36.848 ms/op 1.13
getCommitteeAssignments - req 1 vs - 250000 vc 2.0974 ms/op 1.8011 ms/op 1.16
getCommitteeAssignments - req 100 vs - 250000 vc 4.0071 ms/op 3.5316 ms/op 1.13
getCommitteeAssignments - req 1000 vs - 250000 vc 4.2799 ms/op 3.7908 ms/op 1.13
findModifiedValidators - 10000 modified validators 238.01 ms/op 240.22 ms/op 0.99
findModifiedValidators - 1000 modified validators 167.17 ms/op 145.23 ms/op 1.15
findModifiedValidators - 100 modified validators 164.46 ms/op 153.57 ms/op 1.07
findModifiedValidators - 10 modified validators 165.15 ms/op 157.40 ms/op 1.05
findModifiedValidators - 1 modified validators 175.33 ms/op 140.89 ms/op 1.24
findModifiedValidators - no difference 162.60 ms/op 132.85 ms/op 1.22
compare ViewDUs 3.1299 s/op 2.8832 s/op 1.09
compare each validator Uint8Array 1.6158 s/op 732.10 ms/op 2.21
compare ViewDU to Uint8Array 957.35 ms/op 673.92 ms/op 1.42
migrate state 1000000 validators, 24 modified, 0 new 758.24 ms/op 540.89 ms/op 1.40
migrate state 1000000 validators, 1700 modified, 1000 new 1.0478 s/op 690.83 ms/op 1.52
migrate state 1000000 validators, 3400 modified, 2000 new 1.2439 s/op 914.02 ms/op 1.36
migrate state 1500000 validators, 24 modified, 0 new 779.86 ms/op 626.06 ms/op 1.25
migrate state 1500000 validators, 1700 modified, 1000 new 925.59 ms/op 876.62 ms/op 1.06
migrate state 1500000 validators, 3400 modified, 2000 new 1.2526 s/op 1.1176 s/op 1.12
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.6100 ns/op 6.0100 ns/op 0.77
state getBlockRootAtSlot - 250000 vs - 7PWei 763.16 ns/op 527.91 ns/op 1.45
computeProposers - vc 250000 7.9138 ms/op 5.8048 ms/op 1.36
computeEpochShuffling - vc 250000 41.797 ms/op 34.654 ms/op 1.21
getNextSyncCommittee - vc 250000 127.69 ms/op 97.712 ms/op 1.31
computeSigningRoot for AttestationData 22.675 us/op 20.652 us/op 1.10
hash AttestationData serialized data then Buffer.toString(base64) 1.5383 us/op 1.1869 us/op 1.30
toHexString serialized data 880.39 ns/op 781.92 ns/op 1.13
Buffer.toString(base64) 173.42 ns/op 137.44 ns/op 1.26
nodejs block root to RootHex using toHex 146.68 ns/op 123.32 ns/op 1.19
nodejs block root to RootHex using toRootHex 87.576 ns/op 77.810 ns/op 1.13
browser block root to RootHex using the deprecated toHexString 225.20 ns/op 206.38 ns/op 1.09
browser block root to RootHex using toHex 180.01 ns/op 163.06 ns/op 1.10
browser block root to RootHex using toRootHex 157.34 ns/op 144.92 ns/op 1.09

Please sign in to comment.