Skip to content

Commit

Permalink
chore: make all packages build to be consistent and compatible with c…
Browse files Browse the repository at this point in the history
…js and esm (#426)

* Update ts config for all packages

* Update package.json files

* Add file prefixes to all imports

* Update the ts-node config to use esm

* Upgrade typescript

* Upgrade typescript settings

* Fix the TS warnings and issues

* Fix import paths for types

* Update import path

* Update the import paths in tests

* Fix lint errors

* Fix lint formatting on config files

* Update the benchmark to use ts loader

* Disable the browser tests

* Fix the loader for the esm

* fix: convert prettierrc to yaml

* fix: __dirname to ESM

* fix: revert TS version to fix download-spec-tests ts-node issue

* feat: use spec-test-util for ESM and wget compatibility

* fix: remove ts-expect-error after downgrading TS version

* fix: update SPEC_TEST_LOCATION

* chore: update eslint deps to remove lint error

* chore: lint code per updated lint rules from package update

* fix: convert to node 20 compatible dirname

* fix: convert to node 20 compatible dirname

* Cleanup benchmark loader for ts

* Update the hasher for benchmark

* Revert "Update the hasher for benchmark"

This reverts commit fd9adcc.

* Update the hasher for benchmark

* Update package output dirs

* Update hasher path

---------

Co-authored-by: matthewkeil <[email protected]>
  • Loading branch information
nazarhussain and matthewkeil authored Dec 20, 2024
1 parent b85c774 commit 67bcd88
Show file tree
Hide file tree
Showing 299 changed files with 2,016 additions and 1,244 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages/ssz/spec-tests

benchmark_data/
.failedTest.txt
*.tsbuildinfo

node_modules
.yarn/*
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"check-types": "lerna run check-types",
"coverage": "lerna run coverage",
"test": "lerna run test",
"benchmark:files": "NODE_OPTIONS=--max_old_space_size=4096 benchmark --config .benchrc.yaml",
"benchmark:files": "NODE_OPTIONS='--max_old_space_size=4096 --loader=ts-node/esm' benchmark --config .benchrc.yaml",
"benchmark": "yarn benchmark:files 'packages/*/test/perf/**/*.test.ts'",
"benchmark:local": "yarn benchmark --local",
"check-readme": "lerna run check-readme"
Expand All @@ -28,9 +28,9 @@
"@dapplion/benchmark": "^0.2.2",
"@types/chai": "^4.2.15",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.17",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"babel-loader": "^8.2.2",
"chai": "^4.3.4",
"eslint": "^7.30.0",
Expand All @@ -49,14 +49,14 @@
"mocha": "^8.3.2",
"nyc": "^15.0.0",
"prettier": "^2.2.1",
"ts-loader": "^9.2.8",
"ts-node": "^9.1.1",
"typescript": "~4.2.3",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "~5.4.2",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^3.11.2"
},
"resolutions": {
"@types/react": "^17.0"
}
}
}
7 changes: 7 additions & 0 deletions packages/as-sha256/.mocharc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
colors: true
require:
- ts-node/register
extension:
- "ts"
loader:
- ts-node/esm
9 changes: 9 additions & 0 deletions packages/as-sha256/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
printWidth: 120
tabWidth: 2
useTabs: false
semi: true
singleQuote: false
quoteProps: "as-needed"
trailingComma: "es5"
bracketSpacing: false
arrowParens: "always"
File renamed without changes.
31 changes: 13 additions & 18 deletions packages/as-sha256/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@
"type": "git",
"url": "git+https://github.com/chainsafe/ssz.git"
},
"main": "lib/index.js",
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"types": "lib/index.d.ts",
"type": "module",
"main": "./lib/cjs/index.js",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib",
"build"
Expand All @@ -31,17 +24,19 @@
"clean": "rm -rf ./dist",
"lint": "echo 'no linting for this package'",
"check-types": "echo 'no type check for this package'",
"generate": "rm -rf ./dist && node -r ts-node/register ./scripts/codegen.ts",
"build": "yarn asbuild:untouched && yarn asbuild:optimized && yarn build:lib",
"generate": "rm -rf ./dist && node --loader ts-node/esm ./scripts/codegen.ts",
"build": "yarn asbuild:untouched && yarn asbuild:optimized && yarn build:cjs && yarn build:esm && yarn build:types",
"asbuild:untouched": "asc assembly/index.ts -o build/untouched.wasm -t build/untouched.wat --runtime minimal --target debug --enable simd",
"asbuild:optimized": "asc assembly/index.ts -o build/optimized.wasm -t build/optimized.wat --runtime minimal --target release -O3z --noAssert --enable simd",
"build:lib": "tsc -p tsconfig.build.json",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"build:web": "webpack --mode production --entry ./index.js --output ./dist/as-sha256.min.js",
"test": "yarn run test:unit",
"test:unit": "yarn run test:unit:node && yarn run test:unit:browser",
"test:unit:node": "mocha -r ts-node/register test/unit/*.test.ts",
"test:unit:browser": "karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.js",
"benchmark": "node -r ts-node/register ./node_modules/.bin/benchmark 'test/perf/*.test.ts'",
"test:unit": "yarn run test:unit:node",
"test:unit:node": "yarn mocha test/unit/*.test.ts",
"test:unit:browser": "karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.cjs",
"benchmark": "node --loader ts-node/esm ./node_modules/.bin/benchmark 'test/perf/*.test.ts'",
"benchmark:local": "yarn benchmark --local",
"test:ci": "yarn test:as-ci"
},
Expand Down
29 changes: 0 additions & 29 deletions packages/as-sha256/src/index.d.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/as-sha256/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {allocUnsafe} from "./alloc";
import {newInstance} from "./wasm";
import {HashObject, byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject";
import SHA256 from "./sha256";
import {allocUnsafe} from "./alloc.js";
import {newInstance} from "./wasm.js";
import {HashObject, byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject.js";
import SHA256 from "./sha256.js";
export {HashObject, byteArrayToHashObject, hashObjectToByteArray, byteArrayIntoHashObject, SHA256};

const ctx = newInstance();
Expand Down
2 changes: 1 addition & 1 deletion packages/as-sha256/src/sha256.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {newInstance, WasmContext} from "./wasm";
import {newInstance, WasmContext} from "./wasm.js";

/**
* Class based SHA256
Expand Down
2 changes: 1 addition & 1 deletion packages/as-sha256/src/wasm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {wasmCode} from "./wasmCode";
import {wasmCode} from "./wasmCode.js";

const _module = new WebAssembly.Module(wasmCode);

Expand Down
2 changes: 1 addition & 1 deletion packages/as-sha256/test/perf/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {itBench, setBenchOpts} from "@dapplion/benchmark";
import * as sha256 from "../../src";
import * as sha256 from "../../src/index.js";

// Feb 2024 Mac M1
// digestTwoHashObjects vs digest64 vs digest
Expand Down
4 changes: 2 additions & 2 deletions packages/as-sha256/test/perf/simd.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {itBench, setBenchOpts} from "@dapplion/benchmark";
import * as sha256 from "../../src";
import {byteArrayToHashObject} from "../../src/hashObject";
import * as sha256 from "../../src/index.js";
import {byteArrayToHashObject} from "../../src/hashObject.js";

/**
* This really depends on cpu, on a test ubuntu node, batch*() is 2x faster than digest64
Expand Down
2 changes: 1 addition & 1 deletion packages/as-sha256/test/unit/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Buffer} from "buffer";
import * as sha256 from "../../src";
import * as sha256 from "../../src/index.js";
import {expect} from "chai";

describe("sha256", function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/as-sha256/test/unit/simd.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect} from "chai";
import crypto from "crypto";
import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject";
import * as sha256 from "../../src";
import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject.js";
import * as sha256 from "../../src/index.js";

describe("Test SIMD implementation of as-sha256", () => {
it("testHash4UintArray64s", () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/as-sha256/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.build.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib/cjs",
"typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"],
}
}
8 changes: 8 additions & 0 deletions packages/as-sha256/tsconfig.build.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.build.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib",
"typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"],
}
}
28 changes: 0 additions & 28 deletions packages/as-sha256/tsconfig.build.json

This file was deleted.

8 changes: 8 additions & 0 deletions packages/as-sha256/tsconfig.build.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.build.types.json",
"include": ["src"],
"compilerOptions": {
"outDir": "lib",
"typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"],
}
}
4 changes: 2 additions & 2 deletions packages/as-sha256/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "test"],
"extends": "./tsconfig.build.json",
"compilerOptions": {
"incremental": true
"typeRoots": ["../../node_modules/@types", "./node_modules/@types", "./types"],
}
}
2 changes: 2 additions & 0 deletions packages/persistent-merkle-tree/.mocharc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ colors: true
require:
- ts-node/register
- ../../setHasher.mjs
loader:
- ts-node/esm
File renamed without changes.
11 changes: 0 additions & 11 deletions packages/persistent-merkle-tree/.prettierrc.js

This file was deleted.

23 changes: 10 additions & 13 deletions packages/persistent-merkle-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,26 @@
"name": "@chainsafe/persistent-merkle-tree",
"version": "0.8.0",
"description": "Merkle tree implemented as a persistent datastructure",
"main": "lib/index.js",
"typesVersions": {
"*": {
"*": [
"*",
"lib/*",
"lib/*/index"
]
}
},
"type": "module",
"module": "./lib/index.js",
"main": "./lib/cjs/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"check-types": "tsc --noEmit",
"clean": "rm -rf lib",
"build": "tsc",
"build": "yarn build:cjs && yarn build:esm && yarn build:types",
"build:esm": "tsc -p tsconfig.build.esm.json",
"build:cjs": "tsc -p tsconfig.build.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
"build:types": "tsc -p tsconfig.build.types.json",
"lint": "eslint --color --ext .ts src/",
"lint:fix": "yarn run lint --fix",
"benchmark:files": "node --max-old-space-size=4096 --expose-gc -r ts-node/register ../../node_modules/.bin/benchmark",
"benchmark:files": "node --max-old-space-size=4096 --expose-gc --loader ts-node/esm ../../node_modules/.bin/benchmark",
"benchmark": "yarn benchmark:files 'test/perf/*.test.ts'",
"benchmark:local": "yarn benchmark --local",
"test": "mocha -r ts-node/register 'test/unit/**/*.test.ts'"
"test": "mocha 'test/unit/**/*.test.ts'"
},
"pre-push": [
"lint"
Expand Down
2 changes: 1 addition & 1 deletion packages/persistent-merkle-tree/src/hashComputation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Node} from "./node";
import type {Node} from "./node.js";

/**
* HashComputation to be later used to compute hash of nodes from bottom up.
Expand Down
8 changes: 4 additions & 4 deletions packages/persistent-merkle-tree/src/hasher/as-sha256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
batchHash4HashObjectInputs,
hashInto,
} from "@chainsafe/as-sha256";
import type {Hasher} from "./types";
import {Node} from "../node";
import type {HashComputationLevel} from "../hashComputation";
import {BLOCK_SIZE, doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util";
import type {Hasher} from "./types.js";
import {Node} from "../node.js";
import type {HashComputationLevel} from "../hashComputation.js";
import {BLOCK_SIZE, doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.js";

/**
* hashInto() function of as-sha256 loop through every 256 bytes
Expand Down
10 changes: 5 additions & 5 deletions packages/persistent-merkle-tree/src/hasher/hashtree.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {hashInto} from "@chainsafe/hashtree";
import {Hasher, HashObject} from "./types";
import {Node} from "../node";
import type {HashComputationLevel} from "../hashComputation";
import {byteArrayIntoHashObject} from "@chainsafe/as-sha256/lib/hashObject";
import {doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util";
import {Hasher, HashObject} from "./types.js";
import {Node} from "../node.js";
import type {HashComputationLevel} from "../hashComputation.js";
import {byteArrayIntoHashObject} from "@chainsafe/as-sha256";
import {doDigestNLevel, doMerkleizeBlockArray, doMerkleizeBlocksBytes} from "./util.js";

/**
* Best SIMD implementation is in 512 bits = 64 bytes
Expand Down
10 changes: 5 additions & 5 deletions packages/persistent-merkle-tree/src/hasher/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Hasher} from "./types";
import {hasher as nobleHasher} from "./noble";
import type {HashComputationLevel} from "../hashComputation";
import {Hasher} from "./types.js";
import {hasher as nobleHasher} from "./noble.js";
import type {HashComputationLevel} from "../hashComputation.js";

export * from "./types";
export * from "./util";
export * from "./types.js";
export * from "./util.js";

/**
* Hasher used across the SSZ codebase, by default, this does not support batch hash.
Expand Down
4 changes: 2 additions & 2 deletions packages/persistent-merkle-tree/src/hasher/noble.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {sha256} from "@noble/hashes/sha256";
import {digest64HashObjects, byteArrayIntoHashObject} from "@chainsafe/as-sha256";
import type {Hasher} from "./types";
import type {Hasher} from "./types.js";
import {
BLOCK_SIZE,
doDigestNLevel,
doMerkleizeBlockArray,
doMerkleizeBlocksBytes,
hashObjectToUint8Array,
} from "./util";
} from "./util.js";

const digest64 = (a: Uint8Array, b: Uint8Array): Uint8Array => sha256.create().update(a).update(b).digest();
const hashInto = (input: Uint8Array, output: Uint8Array): void => {
Expand Down
Loading

1 comment on commit 67bcd88

@github-actions
Copy link

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: 67bcd88 Previous: b85c774 Ratio
new LeafNode() x7812.5 348.47 us/op 14.757 us/op 23.61
packedRootsBytesToLeafNodes bytes 4000 offset 0 7.2120 us/op 2.1290 us/op 3.39
packedRootsBytesToLeafNodes bytes 4000 offset 1 7.1830 us/op 2.1010 us/op 3.42
packedRootsBytesToLeafNodes bytes 4000 offset 2 7.1300 us/op 2.1210 us/op 3.36
packedRootsBytesToLeafNodes bytes 4000 offset 3 7.2200 us/op 2.1080 us/op 3.43
setRoot - gindexBitstring 30.338 ms/op 8.7088 ms/op 3.48
setRoot - gindex 32.009 ms/op 9.3895 ms/op 3.41
getHashObject then setHashObject 32.499 ms/op 10.232 ms/op 3.18
setNodeWithFn 30.711 ms/op 7.8345 ms/op 3.92
cachePermanentRootStruct no cache 23.078 us/op 5.4560 us/op 4.23
BeaconState ViewDU hashTreeRoot() vc=200000 622.47 ms/op 101.87 ms/op 6.11
BeaconState ViewDU batchHashTreeRoot vc=200000 450.06 ms/op 92.554 ms/op 4.86
BeaconState ViewDU hashTreeRoot - commit step vc=200000 412.77 ms/op 78.884 ms/op 5.23
BeaconState ViewDU hashTreeRoot - hash step vc=200000 75.035 ms/op 14.985 ms/op 5.01
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 1.4022 ms/op 351.09 us/op 3.99
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 1.3746 ms/op 352.45 us/op 3.90
hashTreeRoot Attestation - struct 129.30 us/op 23.982 us/op 5.39
hashTreeRoot Attestation - tree 137.54 us/op 9.3390 us/op 14.73
hashTreeRoot SignedAggregateAndProof - struct 178.99 us/op 27.461 us/op 6.52
hashTreeRoot SignedAggregateAndProof - tree 162.40 us/op 12.785 us/op 12.70
hashTreeRoot SyncCommitteeMessage - struct 32.456 us/op 7.1710 us/op 4.53
hashTreeRoot SyncCommitteeMessage - tree 36.496 us/op 3.1890 us/op 11.44
hashTreeRoot SignedContributionAndProof - struct 102.88 us/op 16.279 us/op 6.32
hashTreeRoot SignedContributionAndProof - tree 105.59 us/op 8.8600 us/op 11.92
hashTreeRoot SignedBeaconBlock - struct 7.7297 ms/op 1.3098 ms/op 5.90
hashTreeRoot SignedBeaconBlock - tree 7.1112 ms/op 769.95 us/op 9.24
hashTreeRoot Validator - struct 33.093 us/op 7.8960 us/op 4.19
hashTreeRoot Validator - tree 38.402 us/op 6.4460 us/op 5.96
BeaconState vc 300000 - hashTreeRoot tree 13.470 s/op 2.1253 s/op 6.34
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 12.266 us/op 1000.0 ns/op 12.27
BeaconState.validators vc 300000 - hashTreeRoot tree 13.300 s/op 2.0762 s/op 6.41
BeaconState.balances vc 300000 - hashTreeRoot tree 347.50 ms/op 32.424 ms/op 10.72
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 47.842 ms/op 4.0562 ms/op 11.79
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 43.464 ms/op 4.0246 ms/op 10.80
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 345.34 ms/op 36.705 ms/op 9.41
hash64 x18 57.063 us/op 10.087 us/op 5.66
hashTwoObjects x18 78.961 us/op 8.7350 us/op 9.04
hash64 x1740 5.4195 ms/op 813.85 us/op 6.66
hashTwoObjects x1740 7.6401 ms/op 792.83 us/op 9.64
hash64 x2700000 8.2063 s/op 1.2765 s/op 6.43
hashTwoObjects x2700000 11.876 s/op 1.2532 s/op 9.48
set_exitEpoch_and_hashTreeRoot - ContainerType 14.952 us/op 2.5340 us/op 5.90
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 37.650 us/op 6.7930 us/op 5.54
List(uint8) 100000 binary -> tree_backed 339.52 us/op 93.457 us/op 3.63

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 67bcd88 Previous: b85c774 Ratio
getNodeAtDepth depth 0 x100000 280.74 us/op 1.1311 ms/op 0.25
getNodesAtDepth depth 0 x100000 312.18 us/op 1.0529 ms/op 0.30
getNodeAtDepth depth 1 x100000 342.23 us/op 1.1853 ms/op 0.29
Full benchmark results
Benchmark suite Current: 67bcd88 Previous: b85c774 Ratio
digestTwoHashObjects 50023 times 48.534 ms/op 48.536 ms/op 1.00
digest64 50023 times 54.307 ms/op 53.508 ms/op 1.01
digest 50023 times 59.754 ms/op 55.222 ms/op 1.08
input length 32 1.2640 us/op 1.2570 us/op 1.01
input length 64 1.4560 us/op 1.3470 us/op 1.08
input length 128 2.4600 us/op 2.2830 us/op 1.08
input length 256 3.6240 us/op 3.3960 us/op 1.07
input length 512 5.9160 us/op 5.6350 us/op 1.05
input length 1024 11.497 us/op 10.798 us/op 1.06
digest 1000000 times 963.19 ms/op 878.26 ms/op 1.10
hashObjectToByteArray 50023 times 1.2444 ms/op 1.7190 ms/op 0.72
byteArrayToHashObject 50023 times 1.8378 ms/op 2.3234 ms/op 0.79
digest64 200092 times 228.31 ms/op 216.85 ms/op 1.05
hash 200092 times using batchHash4UintArray64s 261.17 ms/op 236.53 ms/op 1.10
digest64HashObjects 200092 times 216.93 ms/op 195.25 ms/op 1.11
hash 200092 times using batchHash4HashObjectInputs 225.43 ms/op 203.70 ms/op 1.11
getGindicesAtDepth 4.5980 us/op 4.2560 us/op 1.08
iterateAtDepth 7.7860 us/op 7.7310 us/op 1.01
getGindexBits 489.00 ns/op 470.00 ns/op 1.04
gindexIterator 1.0870 us/op 1.0910 us/op 1.00
HashComputationLevel.push then loop 35.178 ms/op 27.975 ms/op 1.26
HashComputation[] push then loop 51.206 ms/op 48.481 ms/op 1.06
hash 2 Uint8Array 500000 times - as-sha256 547.45 ms/op 544.36 ms/op 1.01
hashTwoObjects 500000 times - as-sha256 503.27 ms/op 511.80 ms/op 0.98
executeHashComputations - as-sha256 50.429 ms/op 45.956 ms/op 1.10
hash 2 Uint8Array 500000 times - noble 1.3393 s/op 1.1845 s/op 1.13
hashTwoObjects 500000 times - noble 1.9093 s/op 1.6264 s/op 1.17
executeHashComputations - noble 44.044 ms/op 41.576 ms/op 1.06
hash 2 Uint8Array 500000 times - hashtree 230.05 ms/op 222.41 ms/op 1.03
hashTwoObjects 500000 times - hashtree 223.71 ms/op 214.51 ms/op 1.04
executeHashComputations - hashtree 11.933 ms/op 11.231 ms/op 1.06
getHashComputations 3.1171 ms/op 2.8547 ms/op 1.09
executeHashComputations 13.363 ms/op 11.876 ms/op 1.13
get root 15.899 ms/op 16.253 ms/op 0.98
getNodeH() x7812.5 avg hindex 12.304 us/op 12.155 us/op 1.01
getNodeH() x7812.5 index 0 7.4900 us/op 6.2880 us/op 1.19
getNodeH() x7812.5 index 7 7.5500 us/op 6.2560 us/op 1.21
getNodeH() x7812.5 index 7 with key array 6.2710 us/op 6.2610 us/op 1.00
new LeafNode() x7812.5 348.47 us/op 14.757 us/op 23.61
getHashComputations 250000 nodes 18.653 ms/op 19.764 ms/op 0.94
batchHash 250000 nodes 95.616 ms/op 88.754 ms/op 1.08
get root 250000 nodes 119.05 ms/op 114.77 ms/op 1.04
getHashComputations 500000 nodes 30.525 ms/op 29.380 ms/op 1.04
batchHash 500000 nodes 181.21 ms/op 151.99 ms/op 1.19
get root 500000 nodes 239.66 ms/op 239.31 ms/op 1.00
getHashComputations 1000000 nodes 70.064 ms/op 86.429 ms/op 0.81
batchHash 1000000 nodes 405.13 ms/op 348.27 ms/op 1.16
get root 1000000 nodes 489.02 ms/op 453.36 ms/op 1.08
multiproof - depth 15, 1 requested leaves 9.5110 us/op 8.5830 us/op 1.11
tree offset multiproof - depth 15, 1 requested leaves 20.496 us/op 17.973 us/op 1.14
compact multiproof - depth 15, 1 requested leaves 4.0970 us/op 3.4940 us/op 1.17
multiproof - depth 15, 2 requested leaves 13.534 us/op 12.223 us/op 1.11
tree offset multiproof - depth 15, 2 requested leaves 24.609 us/op 21.601 us/op 1.14
compact multiproof - depth 15, 2 requested leaves 3.9200 us/op 3.5190 us/op 1.11
multiproof - depth 15, 3 requested leaves 18.742 us/op 16.742 us/op 1.12
tree offset multiproof - depth 15, 3 requested leaves 31.574 us/op 27.898 us/op 1.13
compact multiproof - depth 15, 3 requested leaves 5.2900 us/op 4.1800 us/op 1.27
multiproof - depth 15, 4 requested leaves 24.069 us/op 22.017 us/op 1.09
tree offset multiproof - depth 15, 4 requested leaves 38.556 us/op 34.892 us/op 1.11
compact multiproof - depth 15, 4 requested leaves 6.3280 us/op 4.8890 us/op 1.29
packedRootsBytesToLeafNodes bytes 4000 offset 0 7.2120 us/op 2.1290 us/op 3.39
packedRootsBytesToLeafNodes bytes 4000 offset 1 7.1830 us/op 2.1010 us/op 3.42
packedRootsBytesToLeafNodes bytes 4000 offset 2 7.1300 us/op 2.1210 us/op 3.36
packedRootsBytesToLeafNodes bytes 4000 offset 3 7.2200 us/op 2.1080 us/op 3.43
subtreeFillToContents depth 40 count 250000 52.492 ms/op 45.620 ms/op 1.15
setRoot - gindexBitstring 30.338 ms/op 8.7088 ms/op 3.48
setRoot - gindex 32.009 ms/op 9.3895 ms/op 3.41
getRoot - gindexBitstring 3.1038 ms/op 2.5720 ms/op 1.21
getRoot - gindex 3.7137 ms/op 3.2986 ms/op 1.13
getHashObject then setHashObject 32.499 ms/op 10.232 ms/op 3.18
setNodeWithFn 30.711 ms/op 7.8345 ms/op 3.92
getNodeAtDepth depth 0 x100000 280.74 us/op 1.1311 ms/op 0.25
setNodeAtDepth depth 0 x100000 4.6873 ms/op 2.4777 ms/op 1.89
getNodesAtDepth depth 0 x100000 312.18 us/op 1.0529 ms/op 0.30
setNodesAtDepth depth 0 x100000 762.22 us/op 1.5167 ms/op 0.50
getNodeAtDepth depth 1 x100000 342.23 us/op 1.1853 ms/op 0.29
setNodeAtDepth depth 1 x100000 13.373 ms/op 5.3263 ms/op 2.51
getNodesAtDepth depth 1 x100000 436.20 us/op 1.1778 ms/op 0.37
setNodesAtDepth depth 1 x100000 11.255 ms/op 4.4690 ms/op 2.52
getNodeAtDepth depth 2 x100000 759.77 us/op 1.4546 ms/op 0.52
setNodeAtDepth depth 2 x100000 24.167 ms/op 9.4026 ms/op 2.57
getNodesAtDepth depth 2 x100000 21.294 ms/op 18.158 ms/op 1.17
setNodesAtDepth depth 2 x100000 31.703 ms/op 13.590 ms/op 2.33
tree.getNodesAtDepth - gindexes 12.719 ms/op 7.2915 ms/op 1.74
tree.getNodesAtDepth - push all nodes 5.1470 ms/op 1.9092 ms/op 2.70
tree.getNodesAtDepth - navigation 311.54 us/op 233.78 us/op 1.33
tree.setNodesAtDepth - indexes 1.1858 ms/op 427.36 us/op 2.77
set at depth 8 1.1310 us/op 507.00 ns/op 2.23
set at depth 16 1.7230 us/op 650.00 ns/op 2.65
set at depth 32 2.9230 us/op 994.00 ns/op 2.94
iterateNodesAtDepth 8 256 17.667 us/op 13.185 us/op 1.34
getNodesAtDepth 8 256 4.4100 us/op 3.3670 us/op 1.31
iterateNodesAtDepth 16 65536 5.3122 ms/op 4.1300 ms/op 1.29
getNodesAtDepth 16 65536 4.0677 ms/op 1.6244 ms/op 2.50
iterateNodesAtDepth 32 250000 19.013 ms/op 15.374 ms/op 1.24
getNodesAtDepth 32 250000 8.4214 ms/op 4.3443 ms/op 1.94
iterateNodesAtDepth 40 250000 19.117 ms/op 15.390 ms/op 1.24
getNodesAtDepth 40 250000 8.6194 ms/op 4.3523 ms/op 1.98
250000 validators root getter 121.23 ms/op 127.33 ms/op 0.95
250000 validators batchHash() 142.47 ms/op 87.862 ms/op 1.62
250000 validators hashComputations 22.696 ms/op 15.418 ms/op 1.47
bitlist bytes to struct (120,90) 920.00 ns/op 1.0560 us/op 0.87
bitlist bytes to tree (120,90) 3.4900 us/op 3.8980 us/op 0.90
bitlist bytes to struct (2048,2048) 1.5770 us/op 1.4220 us/op 1.11
bitlist bytes to tree (2048,2048) 6.2810 us/op 5.6990 us/op 1.10
ByteListType - deserialize 12.107 ms/op 8.3725 ms/op 1.45
BasicListType - deserialize 16.994 ms/op 19.068 ms/op 0.89
ByteListType - serialize 12.032 ms/op 7.6498 ms/op 1.57
BasicListType - serialize 16.130 ms/op 10.823 ms/op 1.49
BasicListType - tree_convertToStruct 36.064 ms/op 31.191 ms/op 1.16
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 7.2252 ms/op 4.7460 ms/op 1.52
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.2639 ms/op 3.9898 ms/op 1.07
Array.push len 300000 empty Array - number 7.5834 ms/op 6.4853 ms/op 1.17
Array.set len 300000 from new Array - number 2.9362 ms/op 1.7454 ms/op 1.68
Array.set len 300000 - number 7.7359 ms/op 5.2574 ms/op 1.47
Uint8Array.set len 300000 497.16 us/op 471.64 us/op 1.05
Uint32Array.set len 300000 591.39 us/op 538.88 us/op 1.10
Container({a: uint8, b: uint8}) getViewDU x300000 30.896 ms/op 44.601 ms/op 0.69
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.371 ms/op 10.931 ms/op 1.13
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 252.50 ms/op 198.91 ms/op 1.27
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 319.45 ms/op 235.32 ms/op 1.36
List(Container) len 300000 ViewDU.get(i) 9.4577 ms/op 6.3482 ms/op 1.49
List(Container) len 300000 ViewDU.getReadonly(i) 8.9362 ms/op 6.1997 ms/op 1.44
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 41.379 ms/op 33.690 ms/op 1.23
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 7.7182 ms/op 5.3752 ms/op 1.44
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 7.9956 ms/op 5.9631 ms/op 1.34
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 7.8038 ms/op 5.8283 ms/op 1.34
Array.push len 300000 empty Array - object 7.9760 ms/op 5.8887 ms/op 1.35
Array.set len 300000 from new Array - object 2.7097 ms/op 2.1849 ms/op 1.24
Array.set len 300000 - object 7.7203 ms/op 5.5874 ms/op 1.38
cachePermanentRootStruct no cache 23.078 us/op 5.4560 us/op 4.23
cachePermanentRootStruct with cache 307.00 ns/op 202.00 ns/op 1.52
epochParticipation len 250000 rws 7813 2.6454 ms/op 2.1532 ms/op 1.23
BeaconState ViewDU hashTreeRoot() vc=200000 622.47 ms/op 101.87 ms/op 6.11
BeaconState ViewDU recursive hash - commit step vc=200000 5.1588 ms/op 4.3848 ms/op 1.18
BeaconState ViewDU validator tree creation vc=10000 44.505 ms/op 34.236 ms/op 1.30
BeaconState ViewDU batchHashTreeRoot vc=200000 450.06 ms/op 92.554 ms/op 4.86
BeaconState ViewDU hashTreeRoot - commit step vc=200000 412.77 ms/op 78.884 ms/op 5.23
BeaconState ViewDU hashTreeRoot - hash step vc=200000 75.035 ms/op 14.985 ms/op 5.01
deserialize Attestation - tree 4.4230 us/op 4.1470 us/op 1.07
deserialize Attestation - struct 2.4120 us/op 1.8640 us/op 1.29
deserialize SignedAggregateAndProof - tree 6.1330 us/op 3.8120 us/op 1.61
deserialize SignedAggregateAndProof - struct 3.9570 us/op 2.9570 us/op 1.34
deserialize SyncCommitteeMessage - tree 1.6970 us/op 1.1210 us/op 1.51
deserialize SyncCommitteeMessage - struct 1.3570 us/op 1.1400 us/op 1.19
deserialize SignedContributionAndProof - tree 3.5800 us/op 2.1480 us/op 1.67
deserialize SignedContributionAndProof - struct 3.0830 us/op 2.2630 us/op 1.36
deserialize SignedBeaconBlock - tree 366.50 us/op 214.56 us/op 1.71
deserialize SignedBeaconBlock - struct 167.06 us/op 118.17 us/op 1.41
BeaconState vc 300000 - deserialize tree 753.75 ms/op 581.90 ms/op 1.30
BeaconState vc 300000 - serialize tree 185.45 ms/op 120.60 ms/op 1.54
BeaconState.historicalRoots vc 300000 - deserialize tree 1.0190 us/op 802.00 ns/op 1.27
BeaconState.historicalRoots vc 300000 - serialize tree 855.00 ns/op 649.00 ns/op 1.32
BeaconState.validators vc 300000 - deserialize tree 727.49 ms/op 576.85 ms/op 1.26
BeaconState.validators vc 300000 - serialize tree 136.73 ms/op 103.76 ms/op 1.32
BeaconState.balances vc 300000 - deserialize tree 30.668 ms/op 22.639 ms/op 1.35
BeaconState.balances vc 300000 - serialize tree 6.4318 ms/op 3.3771 ms/op 1.90
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 1.4022 ms/op 351.09 us/op 3.99
BeaconState.previousEpochParticipation vc 300000 - serialize tree 349.95 us/op 294.11 us/op 1.19
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 1.3746 ms/op 352.45 us/op 3.90
BeaconState.currentEpochParticipation vc 300000 - serialize tree 356.14 us/op 292.25 us/op 1.22
BeaconState.inactivityScores vc 300000 - deserialize tree 31.678 ms/op 22.947 ms/op 1.38
BeaconState.inactivityScores vc 300000 - serialize tree 7.9826 ms/op 3.7328 ms/op 2.14
hashTreeRoot Attestation - struct 129.30 us/op 23.982 us/op 5.39
hashTreeRoot Attestation - tree 137.54 us/op 9.3390 us/op 14.73
hashTreeRoot SignedAggregateAndProof - struct 178.99 us/op 27.461 us/op 6.52
hashTreeRoot SignedAggregateAndProof - tree 162.40 us/op 12.785 us/op 12.70
hashTreeRoot SyncCommitteeMessage - struct 32.456 us/op 7.1710 us/op 4.53
hashTreeRoot SyncCommitteeMessage - tree 36.496 us/op 3.1890 us/op 11.44
hashTreeRoot SignedContributionAndProof - struct 102.88 us/op 16.279 us/op 6.32
hashTreeRoot SignedContributionAndProof - tree 105.59 us/op 8.8600 us/op 11.92
hashTreeRoot SignedBeaconBlock - struct 7.7297 ms/op 1.3098 ms/op 5.90
hashTreeRoot SignedBeaconBlock - tree 7.1112 ms/op 769.95 us/op 9.24
hashTreeRoot Validator - struct 33.093 us/op 7.8960 us/op 4.19
hashTreeRoot Validator - tree 38.402 us/op 6.4460 us/op 5.96
BeaconState vc 300000 - hashTreeRoot tree 13.470 s/op 2.1253 s/op 6.34
BeaconState vc 300000 - batchHashTreeRoot tree 7.0883 s/op 3.4322 s/op 2.07
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 12.266 us/op 1000.0 ns/op 12.27
BeaconState.validators vc 300000 - hashTreeRoot tree 13.300 s/op 2.0762 s/op 6.41
BeaconState.balances vc 300000 - hashTreeRoot tree 347.50 ms/op 32.424 ms/op 10.72
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 47.842 ms/op 4.0562 ms/op 11.79
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 43.464 ms/op 4.0246 ms/op 10.80
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 345.34 ms/op 36.705 ms/op 9.41
hash64 x18 57.063 us/op 10.087 us/op 5.66
hashTwoObjects x18 78.961 us/op 8.7350 us/op 9.04
hash64 x1740 5.4195 ms/op 813.85 us/op 6.66
hashTwoObjects x1740 7.6401 ms/op 792.83 us/op 9.64
hash64 x2700000 8.2063 s/op 1.2765 s/op 6.43
hashTwoObjects x2700000 11.876 s/op 1.2532 s/op 9.48
get_exitEpoch - ContainerType 349.00 ns/op 218.00 ns/op 1.60
get_exitEpoch - ContainerNodeStructType 308.00 ns/op 218.00 ns/op 1.41
set_exitEpoch - ContainerType 333.00 ns/op 227.00 ns/op 1.47
set_exitEpoch - ContainerNodeStructType 300.00 ns/op 229.00 ns/op 1.31
get_pubkey - ContainerType 1.0480 us/op 874.00 ns/op 1.20
get_pubkey - ContainerNodeStructType 265.00 ns/op 215.00 ns/op 1.23
hashTreeRoot - ContainerType 526.00 ns/op 399.00 ns/op 1.32
hashTreeRoot - ContainerNodeStructType 493.00 ns/op 424.00 ns/op 1.16
createProof - ContainerType 4.6860 us/op 3.9640 us/op 1.18
createProof - ContainerNodeStructType 24.618 us/op 20.130 us/op 1.22
serialize - ContainerType 2.0110 us/op 1.8220 us/op 1.10
serialize - ContainerNodeStructType 1.6850 us/op 1.3470 us/op 1.25
set_exitEpoch_and_hashTreeRoot - ContainerType 14.952 us/op 2.5340 us/op 5.90
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 37.650 us/op 6.7930 us/op 5.54
Array - for of 5.7940 us/op 5.5260 us/op 1.05
Array - for(;;) 5.7660 us/op 5.5120 us/op 1.05
basicListValue.readonlyValuesArray() 5.8944 ms/op 4.2127 ms/op 1.40
basicListValue.readonlyValuesArray() + loop all 6.4809 ms/op 4.3204 ms/op 1.50
compositeListValue.readonlyValuesArray() 29.846 ms/op 25.619 ms/op 1.17
compositeListValue.readonlyValuesArray() + loop all 32.682 ms/op 28.646 ms/op 1.14
Number64UintType - get balances list 4.9500 ms/op 4.1201 ms/op 1.20
Number64UintType - set balances list 10.209 ms/op 10.071 ms/op 1.01
Number64UintType - get and increase 10 then set 46.200 ms/op 40.437 ms/op 1.14
Number64UintType - increase 10 using applyDelta 17.176 ms/op 16.219 ms/op 1.06
Number64UintType - increase 10 using applyDeltaInBatch 16.435 ms/op 15.821 ms/op 1.04
tree_newTreeFromUint64Deltas 22.433 ms/op 15.837 ms/op 1.42
unsafeUint8ArrayToTree 41.909 ms/op 31.503 ms/op 1.33
bitLength(50) 279.00 ns/op 224.00 ns/op 1.25
bitLengthStr(50) 245.00 ns/op 206.00 ns/op 1.19
bitLength(8000) 265.00 ns/op 206.00 ns/op 1.29
bitLengthStr(8000) 297.00 ns/op 260.00 ns/op 1.14
bitLength(250000) 265.00 ns/op 206.00 ns/op 1.29
bitLengthStr(250000) 311.00 ns/op 284.00 ns/op 1.10
floor - Math.floor (53) 1.2444 ns/op 1.2351 ns/op 1.01
floor - << 0 (53) 1.2431 ns/op 1.2370 ns/op 1.00
floor - Math.floor (512) 1.2434 ns/op 1.2402 ns/op 1.00
floor - << 0 (512) 1.2438 ns/op 1.2370 ns/op 1.01
fnIf(0) 1.5543 ns/op 1.5484 ns/op 1.00
fnSwitch(0) 2.1756 ns/op 2.2014 ns/op 0.99
fnObj(0) 1.5792 ns/op 1.5470 ns/op 1.02
fnArr(0) 1.5817 ns/op 1.5471 ns/op 1.02
fnIf(4) 2.1766 ns/op 2.1656 ns/op 1.01
fnSwitch(4) 2.1769 ns/op 2.1653 ns/op 1.01
fnObj(4) 1.5674 ns/op 1.5520 ns/op 1.01
fnArr(4) 1.5579 ns/op 1.5516 ns/op 1.00
fnIf(9) 3.1086 ns/op 3.0919 ns/op 1.01
fnSwitch(9) 2.1822 ns/op 2.1642 ns/op 1.01
fnObj(9) 1.5621 ns/op 1.5467 ns/op 1.01
fnArr(9) 1.5553 ns/op 1.5465 ns/op 1.01
Container {a,b,vec} - as struct x100000 124.67 us/op 123.92 us/op 1.01
Container {a,b,vec} - as tree x100000 532.84 us/op 340.57 us/op 1.56
Container {a,vec,b} - as struct x100000 155.80 us/op 155.13 us/op 1.00
Container {a,vec,b} - as tree x100000 503.38 us/op 371.57 us/op 1.35
get 2 props x1000000 - rawObject 311.26 us/op 309.67 us/op 1.01
get 2 props x1000000 - proxy 75.486 ms/op 72.876 ms/op 1.04
get 2 props x1000000 - customObj 311.17 us/op 309.55 us/op 1.01
Simple object binary -> struct 919.00 ns/op 710.00 ns/op 1.29
Simple object binary -> tree_backed 2.4390 us/op 1.3720 us/op 1.78
Simple object struct -> tree_backed 2.8430 us/op 1.9870 us/op 1.43
Simple object tree_backed -> struct 1.9930 us/op 1.8870 us/op 1.06
Simple object struct -> binary 1.0970 us/op 934.00 ns/op 1.17
Simple object tree_backed -> binary 1.9160 us/op 1.6330 us/op 1.17
aggregationBits binary -> struct 703.00 ns/op 650.00 ns/op 1.08
aggregationBits binary -> tree_backed 2.7310 us/op 2.5040 us/op 1.09
aggregationBits struct -> tree_backed 3.2070 us/op 2.8930 us/op 1.11
aggregationBits tree_backed -> struct 1.2990 us/op 1.2520 us/op 1.04
aggregationBits struct -> binary 714.00 ns/op 809.00 ns/op 0.88
aggregationBits tree_backed -> binary 1.0160 us/op 1.0750 us/op 0.95
List(uint8) 100000 binary -> struct 1.6494 ms/op 1.5750 ms/op 1.05
List(uint8) 100000 binary -> tree_backed 339.52 us/op 93.457 us/op 3.63
List(uint8) 100000 struct -> tree_backed 1.4676 ms/op 1.1718 ms/op 1.25
List(uint8) 100000 tree_backed -> struct 1.2180 ms/op 1.1461 ms/op 1.06
List(uint8) 100000 struct -> binary 1.2050 ms/op 1.0313 ms/op 1.17
List(uint8) 100000 tree_backed -> binary 109.59 us/op 92.057 us/op 1.19
List(uint64Number) 100000 binary -> struct 1.4993 ms/op 1.2073 ms/op 1.24
List(uint64Number) 100000 binary -> tree_backed 4.5535 ms/op 2.4318 ms/op 1.87
List(uint64Number) 100000 struct -> tree_backed 7.1613 ms/op 4.1740 ms/op 1.72
List(uint64Number) 100000 tree_backed -> struct 2.9460 ms/op 2.2072 ms/op 1.33
List(uint64Number) 100000 struct -> binary 1.8056 ms/op 1.3973 ms/op 1.29
List(uint64Number) 100000 tree_backed -> binary 1.0936 ms/op 914.01 us/op 1.20
List(Uint64Bigint) 100000 binary -> struct 4.1210 ms/op 3.5588 ms/op 1.16
List(Uint64Bigint) 100000 binary -> tree_backed 5.4431 ms/op 3.3438 ms/op 1.63
List(Uint64Bigint) 100000 struct -> tree_backed 7.7106 ms/op 4.6908 ms/op 1.64
List(Uint64Bigint) 100000 tree_backed -> struct 5.6203 ms/op 4.2703 ms/op 1.32
List(Uint64Bigint) 100000 struct -> binary 2.0891 ms/op 2.0126 ms/op 1.04
List(Uint64Bigint) 100000 tree_backed -> binary 1.8251 ms/op 951.41 us/op 1.92
Vector(Root) 100000 binary -> struct 37.245 ms/op 31.637 ms/op 1.18
Vector(Root) 100000 binary -> tree_backed 42.026 ms/op 26.588 ms/op 1.58
Vector(Root) 100000 struct -> tree_backed 49.755 ms/op 42.917 ms/op 1.16
Vector(Root) 100000 tree_backed -> struct 50.143 ms/op 49.612 ms/op 1.01
Vector(Root) 100000 struct -> binary 2.7521 ms/op 2.7788 ms/op 0.99
Vector(Root) 100000 tree_backed -> binary 7.7308 ms/op 8.5391 ms/op 0.91
List(Validator) 100000 binary -> struct 111.36 ms/op 103.41 ms/op 1.08
List(Validator) 100000 binary -> tree_backed 387.51 ms/op 275.64 ms/op 1.41
List(Validator) 100000 struct -> tree_backed 400.61 ms/op 310.87 ms/op 1.29
List(Validator) 100000 tree_backed -> struct 204.14 ms/op 211.56 ms/op 0.96
List(Validator) 100000 struct -> binary 29.547 ms/op 27.227 ms/op 1.09
List(Validator) 100000 tree_backed -> binary 99.169 ms/op 111.06 ms/op 0.89
List(Validator-NS) 100000 binary -> struct 114.05 ms/op 107.96 ms/op 1.06
List(Validator-NS) 100000 binary -> tree_backed 190.85 ms/op 132.67 ms/op 1.44
List(Validator-NS) 100000 struct -> tree_backed 224.46 ms/op 197.03 ms/op 1.14
List(Validator-NS) 100000 tree_backed -> struct 173.86 ms/op 168.35 ms/op 1.03
List(Validator-NS) 100000 struct -> binary 29.662 ms/op 27.103 ms/op 1.09
List(Validator-NS) 100000 tree_backed -> binary 37.867 ms/op 34.881 ms/op 1.09
get epochStatuses - MutableVector 115.24 us/op 97.303 us/op 1.18
get epochStatuses - ViewDU 194.01 us/op 200.64 us/op 0.97
set epochStatuses - ListTreeView 2.1869 ms/op 2.4405 ms/op 0.90
set epochStatuses - ListTreeView - set() 443.43 us/op 436.55 us/op 1.02
set epochStatuses - ListTreeView - commit() 784.12 us/op 535.09 us/op 1.47
bitstring 516.62 ns/op 634.23 ns/op 0.81
bit mask 13.881 ns/op 14.174 ns/op 0.98
struct - increase slot to 1000000 932.73 us/op 927.78 us/op 1.01
UintNumberType - increase slot to 1000000 26.801 ms/op 21.532 ms/op 1.24
UintBigintType - increase slot to 1000000 205.69 ms/op 165.80 ms/op 1.24
UintBigint8 x 100000 tree_deserialize 5.7488 ms/op 5.3078 ms/op 1.08
UintBigint8 x 100000 tree_serialize 625.27 us/op 1.1525 ms/op 0.54
UintBigint16 x 100000 tree_deserialize 6.4120 ms/op 4.4636 ms/op 1.44
UintBigint16 x 100000 tree_serialize 1.7094 ms/op 1.1993 ms/op 1.43
UintBigint32 x 100000 tree_deserialize 6.7822 ms/op 4.7785 ms/op 1.42
UintBigint32 x 100000 tree_serialize 2.1262 ms/op 1.2069 ms/op 1.76
UintBigint64 x 100000 tree_deserialize 7.8151 ms/op 5.4742 ms/op 1.43
UintBigint64 x 100000 tree_serialize 2.0621 ms/op 1.5943 ms/op 1.29
UintBigint8 x 100000 value_deserialize 436.34 us/op 433.56 us/op 1.01
UintBigint8 x 100000 value_serialize 859.14 us/op 650.98 us/op 1.32
UintBigint16 x 100000 value_deserialize 466.54 us/op 464.34 us/op 1.00
UintBigint16 x 100000 value_serialize 969.16 us/op 681.64 us/op 1.42
UintBigint32 x 100000 value_deserialize 497.83 us/op 433.10 us/op 1.15
UintBigint32 x 100000 value_serialize 1.0305 ms/op 720.41 us/op 1.43
UintBigint64 x 100000 value_deserialize 563.99 us/op 496.29 us/op 1.14
UintBigint64 x 100000 value_serialize 1.3526 ms/op 900.86 us/op 1.50
UintBigint8 x 100000 deserialize 4.0309 ms/op 2.8535 ms/op 1.41
UintBigint8 x 100000 serialize 1.6515 ms/op 1.7818 ms/op 0.93
UintBigint16 x 100000 deserialize 3.4411 ms/op 2.8839 ms/op 1.19
UintBigint16 x 100000 serialize 1.6215 ms/op 1.4988 ms/op 1.08
UintBigint32 x 100000 deserialize 3.5847 ms/op 2.9676 ms/op 1.21
UintBigint32 x 100000 serialize 3.1418 ms/op 2.6620 ms/op 1.18
UintBigint64 x 100000 deserialize 4.3650 ms/op 3.9316 ms/op 1.11
UintBigint64 x 100000 serialize 1.6272 ms/op 1.5189 ms/op 1.07
UintBigint128 x 100000 deserialize 5.7066 ms/op 4.9649 ms/op 1.15
UintBigint128 x 100000 serialize 15.115 ms/op 13.794 ms/op 1.10
UintBigint256 x 100000 deserialize 9.4140 ms/op 7.7769 ms/op 1.21
UintBigint256 x 100000 serialize 43.538 ms/op 41.308 ms/op 1.05
Slice from Uint8Array x25000 1.5021 ms/op 1.2228 ms/op 1.23
Slice from ArrayBuffer x25000 16.764 ms/op 15.136 ms/op 1.11
Slice from ArrayBuffer x25000 + new Uint8Array 18.542 ms/op 15.596 ms/op 1.19
Copy Uint8Array 100000 iterate 2.6700 ms/op 2.5895 ms/op 1.03
Copy Uint8Array 100000 slice 124.63 us/op 124.44 us/op 1.00
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 122.71 us/op 123.96 us/op 0.99
Copy Buffer 100000 Uint8Array.prototype.slice.call 124.49 us/op 124.16 us/op 1.00
Copy Uint8Array 100000 slice + set 250.69 us/op 192.06 us/op 1.31
Copy Uint8Array 100000 subarray + set 124.74 us/op 122.50 us/op 1.02
Copy Uint8Array 100000 slice arrayBuffer 128.49 us/op 122.22 us/op 1.05
Uint64 deserialize 100000 - iterate Uint8Array 2.1647 ms/op 1.7530 ms/op 1.23
Uint64 deserialize 100000 - by Uint32A 2.1301 ms/op 1.8819 ms/op 1.13
Uint64 deserialize 100000 - by DataView.getUint32 x2 2.1953 ms/op 1.7765 ms/op 1.24
Uint64 deserialize 100000 - by DataView.getBigUint64 5.3190 ms/op 4.7748 ms/op 1.11
Uint64 deserialize 100000 - by byte 41.069 ms/op 40.276 ms/op 1.02

Please sign in to comment.