Skip to content

Commit

Permalink
fix: Use file path imports (#318)
Browse files Browse the repository at this point in the history
* Use explicit imports

* Fix import paths

* Remove exports

* Fix imports in setHasher
  • Loading branch information
FrederikBolding authored Apr 21, 2023
1 parent 0efce88 commit f459e92
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 19 deletions.
4 changes: 0 additions & 4 deletions packages/as-sha256/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"url": "git+https://github.com/chainsafe/as-sha256.git"
},
"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./hashObject": "./lib/hashObject.js"
},
"typesVersions": {
"*": {
"*": [
Expand Down
6 changes: 0 additions & 6 deletions packages/persistent-merkle-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"version": "0.6.0",
"description": "Merkle tree implemented as a persistent datastructure",
"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./hasher": "./lib/hasher/index.js",
"./hasher/as-sha256": "./lib/hasher/as-sha256.js",
"./hasher/noble": "./lib/hasher/noble.js"
},
"typesVersions": {
"*": {
"*": [
Expand Down
2 changes: 1 addition & 1 deletion packages/persistent-merkle-tree/src/hasher/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Hasher} from "./types";
import {hasher as nobleHasher} from "./noble";

export {HashObject} from "@chainsafe/as-sha256/hashObject";
export {HashObject} from "@chainsafe/as-sha256/lib/hashObject";
export * from "./types";
export * from "./util";

Expand Down
2 changes: 1 addition & 1 deletion packages/persistent-merkle-tree/src/hasher/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {HashObject} from "@chainsafe/as-sha256/hashObject";
import type {HashObject} from "@chainsafe/as-sha256/lib/hashObject";

export type Hasher = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/persistent-merkle-tree/src/hasher/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {byteArrayToHashObject, HashObject, hashObjectToByteArray} from "@chainsafe/as-sha256/hashObject";
import {byteArrayToHashObject, HashObject, hashObjectToByteArray} from "@chainsafe/as-sha256/lib/hashObject";

export function hashObjectToUint8Array(obj: HashObject): Uint8Array {
const byteArr = new Uint8Array(32);
Expand Down
2 changes: 1 addition & 1 deletion packages/persistent-merkle-tree/src/node.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {HashObject} from "@chainsafe/as-sha256/hashObject";
import {HashObject} from "@chainsafe/as-sha256/lib/hashObject";
import {hashObjectToUint8Array, hasher, uint8ArrayToHashObject} from "./hasher";

const TWO_POWER_32 = 2 ** 32;
Expand Down
2 changes: 1 addition & 1 deletion packages/ssz/src/branchNodeStruct.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {HashObject} from "@chainsafe/as-sha256/hashObject";
import {HashObject} from "@chainsafe/as-sha256/lib/hashObject";
import {hashObjectToUint8Array, Node} from "@chainsafe/persistent-merkle-tree";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ssz/src/util/merkleize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {hasher} from "@chainsafe/persistent-merkle-tree/hasher";
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index";
import {zeroHash} from "./zeros";

export function hash64(bytes32A: Uint8Array, bytes32B: Uint8Array): Uint8Array {
Expand Down
2 changes: 1 addition & 1 deletion packages/ssz/src/util/zeros.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {hasher} from "@chainsafe/persistent-merkle-tree/hasher";
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index";

// create array of "zero hashes", successively hashed zero chunks
const zeroHashes = [new Uint8Array(32)];
Expand Down
4 changes: 2 additions & 2 deletions setHasher.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Set the hasher to as-sha256
// Used to run benchmarks with with visibility into as-sha256 performance, useful for Lodestar
import {setHasher} from "@chainsafe/persistent-merkle-tree/hasher";
import {hasher} from "@chainsafe/persistent-merkle-tree/hasher/as-sha256";
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js";
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js";
setHasher(hasher);

1 comment on commit f459e92

@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: f459e92 Previous: 0efce88 Ratio
Number64UintType - get balances list 7.9087 ms/op 2.3337 ms/op 3.39

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: f459e92 Previous: 0efce88 Ratio
List[uint8, 68719476736] len 300000 ViewDU.get(i) 1.6672 ms/op 7.5801 ms/op 0.22
Container({a: uint8, b: uint8}) getViewDU x300000 34.972 ms/op 119.60 ms/op 0.29
Full benchmark results
Benchmark suite Current: f459e92 Previous: 0efce88 Ratio
digestTwoHashObjects 50023 times 74.107 ms/op 69.464 ms/op 1.07
digest64 50023 times 74.825 ms/op 72.243 ms/op 1.04
digest 50023 times 74.705 ms/op 72.622 ms/op 1.03
input length 32 1.7700 us/op 1.8160 us/op 0.97
input length 64 1.9710 us/op 1.9670 us/op 1.00
input length 128 3.3920 us/op 3.3980 us/op 1.00
input length 256 5.0380 us/op 4.9740 us/op 1.01
input length 512 8.4220 us/op 8.1150 us/op 1.04
input length 1024 16.462 us/op 15.912 us/op 1.03
digest 1000000 times 1.2478 s/op 1.2565 s/op 0.99
hashObjectToByteArray 50023 times 2.8034 ms/op 2.8487 ms/op 0.98
byteArrayToHashObject 50023 times 3.2944 ms/op 3.7949 ms/op 0.87
getGindicesAtDepth 7.6380 us/op 7.6710 us/op 1.00
iterateAtDepth 15.393 us/op 15.658 us/op 0.98
getGindexBits 794.00 ns/op 712.00 ns/op 1.12
gindexIterator 1.6360 us/op 1.5740 us/op 1.04
hash 2 Uint8Array 2250026 times - as-sha256 3.2049 s/op 3.3012 s/op 0.97
hashTwoObjects 2250026 times - as-sha256 3.0475 s/op 3.1612 s/op 0.96
hash 2 Uint8Array 2250026 times - noble 10.352 s/op 12.342 s/op 0.84
hashTwoObjects 2250026 times - noble 12.033 s/op 15.338 s/op 0.78
getNodeH() x7812.5 avg hindex 28.052 us/op 30.496 us/op 0.92
getNodeH() x7812.5 index 0 10.197 us/op 10.872 us/op 0.94
getNodeH() x7812.5 index 7 10.064 us/op 10.831 us/op 0.93
getNodeH() x7812.5 index 7 with key array 9.8990 us/op 10.758 us/op 0.92
new LeafNode() x7812.5 353.85 us/op 804.48 us/op 0.44
multiproof - depth 15, 1 requested leaves 17.701 us/op 24.558 us/op 0.72
tree offset multiproof - depth 15, 1 requested leaves 37.484 us/op 51.963 us/op 0.72
compact multiproof - depth 15, 1 requested leaves 9.1790 us/op 16.241 us/op 0.57
multiproof - depth 15, 2 requested leaves 22.192 us/op 31.346 us/op 0.71
tree offset multiproof - depth 15, 2 requested leaves 40.292 us/op 54.346 us/op 0.74
compact multiproof - depth 15, 2 requested leaves 5.2960 us/op 5.9000 us/op 0.90
multiproof - depth 15, 3 requested leaves 30.345 us/op 44.048 us/op 0.69
tree offset multiproof - depth 15, 3 requested leaves 50.454 us/op 72.029 us/op 0.70
compact multiproof - depth 15, 3 requested leaves 8.9820 us/op 17.090 us/op 0.53
multiproof - depth 15, 4 requested leaves 40.784 us/op 56.424 us/op 0.72
tree offset multiproof - depth 15, 4 requested leaves 63.604 us/op 87.764 us/op 0.72
compact multiproof - depth 15, 4 requested leaves 10.346 us/op 16.066 us/op 0.64
packedRootsBytesToLeafNodes bytes 4000 offset 0 3.9730 us/op 6.1380 us/op 0.65
packedRootsBytesToLeafNodes bytes 4000 offset 1 3.7840 us/op 6.6760 us/op 0.57
packedRootsBytesToLeafNodes bytes 4000 offset 2 3.7660 us/op 5.9190 us/op 0.64
packedRootsBytesToLeafNodes bytes 4000 offset 3 3.7770 us/op 6.1600 us/op 0.61
subtreeFillToContents depth 40 count 250000 79.318 ms/op 119.11 ms/op 0.67
setRoot - gindexBitstring 15.327 ms/op 27.981 ms/op 0.55
setRoot - gindex 14.025 ms/op 27.211 ms/op 0.52
getRoot - gindexBitstring 3.9200 ms/op 5.0102 ms/op 0.78
getRoot - gindex 4.7155 ms/op 5.9647 ms/op 0.79
getHashObject then setHashObject 16.567 ms/op 26.176 ms/op 0.63
setNodeWithFn 14.470 ms/op 23.080 ms/op 0.63
getNodeAtDepth depth 0 x100000 2.6113 ms/op 2.5931 ms/op 1.01
setNodeAtDepth depth 0 x100000 4.6145 ms/op 7.0602 ms/op 0.65
getNodesAtDepth depth 0 x100000 2.0589 ms/op 2.5135 ms/op 0.82
setNodesAtDepth depth 0 x100000 2.8198 ms/op 3.1608 ms/op 0.89
getNodeAtDepth depth 1 x100000 2.7325 ms/op 2.9719 ms/op 0.92
setNodeAtDepth depth 1 x100000 10.249 ms/op 16.645 ms/op 0.62
getNodesAtDepth depth 1 x100000 2.3250 ms/op 2.5882 ms/op 0.90
setNodesAtDepth depth 1 x100000 8.1520 ms/op 13.277 ms/op 0.61
getNodeAtDepth depth 2 x100000 3.3125 ms/op 3.6738 ms/op 0.90
setNodeAtDepth depth 2 x100000 16.253 ms/op 24.448 ms/op 0.66
getNodesAtDepth depth 2 x100000 30.275 ms/op 34.792 ms/op 0.87
setNodesAtDepth depth 2 x100000 21.995 ms/op 34.044 ms/op 0.65
tree.getNodesAtDepth - gindexes 9.0138 ms/op 13.909 ms/op 0.65
tree.getNodesAtDepth - push all nodes 2.7735 ms/op 6.3321 ms/op 0.44
tree.getNodesAtDepth - navigation 193.22 us/op 224.34 us/op 0.86
tree.setNodesAtDepth - indexes 580.14 us/op 801.92 us/op 0.72
set at depth 8 725.00 ns/op 1.0360 us/op 0.70
set at depth 16 953.00 ns/op 1.4630 us/op 0.65
set at depth 32 1.5200 us/op 2.4170 us/op 0.63
iterateNodesAtDepth 8 256 24.287 us/op 28.891 us/op 0.84
getNodesAtDepth 8 256 6.2170 us/op 7.0950 us/op 0.88
iterateNodesAtDepth 16 65536 7.3394 ms/op 8.6959 ms/op 0.84
getNodesAtDepth 16 65536 2.6345 ms/op 4.4740 ms/op 0.59
iterateNodesAtDepth 32 250000 27.662 ms/op 31.570 ms/op 0.88
getNodesAtDepth 32 250000 7.6424 ms/op 10.744 ms/op 0.71
iterateNodesAtDepth 40 250000 27.857 ms/op 30.359 ms/op 0.92
getNodesAtDepth 40 250000 7.6834 ms/op 9.6065 ms/op 0.80
250k validators 12.078 s/op 15.431 s/op 0.78
bitlist bytes to struct (120,90) 876.00 ns/op 1.4970 us/op 0.59
bitlist bytes to tree (120,90) 3.6810 us/op 4.8910 us/op 0.75
bitlist bytes to struct (2048,2048) 1.7590 us/op 2.5630 us/op 0.69
bitlist bytes to tree (2048,2048) 6.7920 us/op 8.5620 us/op 0.79
ByteListType - deserialize 18.654 ms/op 21.388 ms/op 0.87
BasicListType - deserialize 15.604 ms/op 20.875 ms/op 0.75
ByteListType - serialize 18.313 ms/op 20.483 ms/op 0.89
BasicListType - serialize 18.735 ms/op 29.057 ms/op 0.64
BasicListType - tree_convertToStruct 34.823 ms/op 58.696 ms/op 0.59
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 6.7161 ms/op 7.7733 ms/op 0.86
List[uint8, 68719476736] len 300000 ViewDU.get(i) 1.6672 ms/op 7.5801 ms/op 0.22
Array.push len 300000 empty Array - number 9.6464 ms/op 12.158 ms/op 0.79
Array.set len 300000 from new Array - number 2.6940 ms/op 3.0778 ms/op 0.88
Array.set len 300000 - number 9.4236 ms/op 9.6488 ms/op 0.98
Uint8Array.set len 300000 282.74 us/op 341.20 us/op 0.83
Uint32Array.set len 300000 400.02 us/op 512.88 us/op 0.78
Container({a: uint8, b: uint8}) getViewDU x300000 34.972 ms/op 119.60 ms/op 0.29
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 13.964 ms/op 23.524 ms/op 0.59
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 610.80 ms/op 716.41 ms/op 0.85
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 504.88 ms/op 641.86 ms/op 0.79
List(Container) len 300000 ViewDU.get(i) 11.689 ms/op 25.092 ms/op 0.47
List(Container) len 300000 ViewDU.getReadonly(i) 11.432 ms/op 14.732 ms/op 0.78
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 67.621 ms/op 113.41 ms/op 0.60
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 8.0312 ms/op 12.120 ms/op 0.66
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 10.644 ms/op 18.932 ms/op 0.56
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 10.290 ms/op 19.025 ms/op 0.54
Array.push len 300000 empty Array - object 9.3486 ms/op 11.334 ms/op 0.82
Array.set len 300000 from new Array - object 3.3920 ms/op 5.5789 ms/op 0.61
Array.set len 300000 - object 9.4943 ms/op 12.089 ms/op 0.79
cachePermanentRootStruct no cache 13.530 us/op 17.547 us/op 0.77
cachePermanentRootStruct with cache 328.00 ns/op 404.00 ns/op 0.81
epochParticipation len 250000 rws 7813 3.6408 ms/op 4.0022 ms/op 0.91
deserialize Attestation - tree 4.5310 us/op 5.9780 us/op 0.76
deserialize Attestation - struct 3.3010 us/op 3.9960 us/op 0.83
deserialize SignedAggregateAndProof - tree 5.9130 us/op 7.8380 us/op 0.75
deserialize SignedAggregateAndProof - struct 5.2650 us/op 6.4660 us/op 0.81
deserialize SyncCommitteeMessage - tree 1.5920 us/op 2.0180 us/op 0.79
deserialize SyncCommitteeMessage - struct 1.9510 us/op 2.4770 us/op 0.79
deserialize SignedContributionAndProof - tree 2.9940 us/op 4.1190 us/op 0.73
deserialize SignedContributionAndProof - struct 4.3660 us/op 5.6110 us/op 0.78
deserialize SignedBeaconBlock - tree 348.52 us/op 458.17 us/op 0.76
deserialize SignedBeaconBlock - struct 227.65 us/op 291.81 us/op 0.78
BeaconState vc 300000 - deserialize tree 1.0162 s/op 1.4184 s/op 0.72
BeaconState vc 300000 - serialize tree 363.93 ms/op 344.59 ms/op 1.06
BeaconState.historicalRoots vc 300000 - deserialize tree 1.2430 us/op 1.4500 us/op 0.86
BeaconState.historicalRoots vc 300000 - serialize tree 1.4640 us/op 2.0550 us/op 0.71
BeaconState.validators vc 300000 - deserialize tree 1.0797 s/op 1.3660 s/op 0.79
BeaconState.validators vc 300000 - serialize tree 283.48 ms/op 325.85 ms/op 0.87
BeaconState.balances vc 300000 - deserialize tree 41.462 ms/op 54.600 ms/op 0.76
BeaconState.balances vc 300000 - serialize tree 6.1265 ms/op 10.353 ms/op 0.59
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 731.13 us/op 1.3204 ms/op 0.55
BeaconState.previousEpochParticipation vc 300000 - serialize tree 545.04 us/op 626.52 us/op 0.87
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 748.91 us/op 1.2829 ms/op 0.58
BeaconState.currentEpochParticipation vc 300000 - serialize tree 514.96 us/op 555.20 us/op 0.93
BeaconState.inactivityScores vc 300000 - deserialize tree 44.581 ms/op 54.832 ms/op 0.81
BeaconState.inactivityScores vc 300000 - serialize tree 7.1235 ms/op 9.9596 ms/op 0.72
hashTreeRoot Attestation - struct 54.836 us/op 68.355 us/op 0.80
hashTreeRoot Attestation - tree 28.622 us/op 33.255 us/op 0.86
hashTreeRoot SignedAggregateAndProof - struct 69.296 us/op 93.573 us/op 0.74
hashTreeRoot SignedAggregateAndProof - tree 41.670 us/op 55.653 us/op 0.75
hashTreeRoot SyncCommitteeMessage - struct 17.402 us/op 22.853 us/op 0.76
hashTreeRoot SyncCommitteeMessage - tree 9.1200 us/op 12.732 us/op 0.72
hashTreeRoot SignedContributionAndProof - struct 48.010 us/op 60.440 us/op 0.79
hashTreeRoot SignedContributionAndProof - tree 32.073 us/op 27.881 us/op 1.15
hashTreeRoot SignedBeaconBlock - struct 4.1593 ms/op 4.7285 ms/op 0.88
hashTreeRoot SignedBeaconBlock - tree 2.3814 ms/op 2.4481 ms/op 0.97
hashTreeRoot Validator - struct 20.740 us/op 23.420 us/op 0.89
hashTreeRoot Validator - tree 17.185 us/op 18.695 us/op 0.92
BeaconState vc 300000 - hashTreeRoot tree 5.3922 s/op 5.9059 s/op 0.91
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 2.1840 us/op 2.2420 us/op 0.97
BeaconState.validators vc 300000 - hashTreeRoot tree 5.1909 s/op 5.4483 s/op 0.95
BeaconState.balances vc 300000 - hashTreeRoot tree 133.02 ms/op 137.86 ms/op 0.96
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 13.223 ms/op 14.627 ms/op 0.90
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 13.113 ms/op 14.841 ms/op 0.88
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 132.43 ms/op 145.73 ms/op 0.91
hash64 x18 27.363 us/op 30.971 us/op 0.88
hashTwoObjects x18 25.664 us/op 29.613 us/op 0.87
hash64 x1740 2.7201 ms/op 2.9710 ms/op 0.92
hashTwoObjects x1740 2.3800 ms/op 2.7033 ms/op 0.88
hash64 x2700000 4.1539 s/op 4.3453 s/op 0.96
hashTwoObjects x2700000 3.8694 s/op 3.8960 s/op 0.99
get_exitEpoch - ContainerType 709.00 ns/op 700.00 ns/op 1.01
get_exitEpoch - ContainerNodeStructType 563.00 ns/op 573.00 ns/op 0.98
set_exitEpoch - ContainerType 586.00 ns/op 667.00 ns/op 0.88
set_exitEpoch - ContainerNodeStructType 544.00 ns/op 606.00 ns/op 0.90
get_pubkey - ContainerType 2.2190 us/op 2.6850 us/op 0.83
get_pubkey - ContainerNodeStructType 459.00 ns/op 459.00 ns/op 1.00
hashTreeRoot - ContainerType 748.00 ns/op 739.00 ns/op 1.01
hashTreeRoot - ContainerNodeStructType 857.00 ns/op 871.00 ns/op 0.98
createProof - ContainerType 8.3830 us/op 9.7510 us/op 0.86
createProof - ContainerNodeStructType 49.097 us/op 59.433 us/op 0.83
serialize - ContainerType 4.1610 us/op 4.3050 us/op 0.97
serialize - ContainerNodeStructType 3.4210 us/op 3.1760 us/op 1.08
set_exitEpoch_and_hashTreeRoot - ContainerType 7.3060 us/op 7.2350 us/op 1.01
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 19.095 us/op 20.833 us/op 0.92
Array - for of 12.783 us/op 17.904 us/op 0.71
Array - for(;;) 8.6920 us/op 14.544 us/op 0.60
basicListValue.readonlyValuesArray() 8.5568 ms/op 8.8882 ms/op 0.96
basicListValue.readonlyValuesArray() + loop all 8.3193 ms/op 8.9064 ms/op 0.93
compositeListValue.readonlyValuesArray() 50.174 ms/op 51.434 ms/op 0.98
compositeListValue.readonlyValuesArray() + loop all 40.114 ms/op 48.930 ms/op 0.82
Number64UintType - get balances list 7.9087 ms/op 2.3337 ms/op 3.39
Number64UintType - set balances list 17.731 ms/op 23.636 ms/op 0.75
Number64UintType - get and increase 10 then set 72.412 ms/op 70.306 ms/op 1.03
Number64UintType - increase 10 using applyDelta 31.187 ms/op 24.600 ms/op 1.27
Number64UintType - increase 10 using applyDeltaInBatch 29.976 ms/op 25.142 ms/op 1.19
tree_newTreeFromUint64Deltas 34.517 ms/op 37.865 ms/op 0.91
unsafeUint8ArrayToTree 57.140 ms/op 65.612 ms/op 0.87
bitLength(50) 366.00 ns/op 423.00 ns/op 0.87
bitLengthStr(50) 442.00 ns/op 469.00 ns/op 0.94
bitLength(8000) 368.00 ns/op 368.00 ns/op 1.00
bitLengthStr(8000) 605.00 ns/op 605.00 ns/op 1.00
bitLength(250000) 352.00 ns/op 374.00 ns/op 0.94
bitLengthStr(250000) 712.00 ns/op 717.00 ns/op 0.99
floor - Math.floor (53) 0.80508 ns/op 0.80434 ns/op 1.00
floor - << 0 (53) 0.80536 ns/op 0.80438 ns/op 1.00
floor - Math.floor (512) 0.80614 ns/op 0.80420 ns/op 1.00
floor - << 0 (512) 0.80462 ns/op 0.80407 ns/op 1.00
fnIf(0) 3.2212 ns/op 3.2159 ns/op 1.00
fnSwitch(0) 6.0327 ns/op 6.0310 ns/op 1.00
fnObj(0) 0.80531 ns/op 0.80400 ns/op 1.00
fnArr(0) 0.80519 ns/op 0.80426 ns/op 1.00
fnIf(4) 5.2315 ns/op 5.2259 ns/op 1.00
fnSwitch(4) 6.0319 ns/op 6.0299 ns/op 1.00
fnObj(4) 0.80467 ns/op 0.80423 ns/op 1.00
fnArr(4) 0.80490 ns/op 0.80958 ns/op 0.99
fnIf(9) 8.0632 ns/op 8.0424 ns/op 1.00
fnSwitch(9) 6.0544 ns/op 6.0327 ns/op 1.00
fnObj(9) 0.80581 ns/op 0.80401 ns/op 1.00
fnArr(9) 0.80683 ns/op 0.80430 ns/op 1.00
Container {a,b,vec} - as struct x100000 81.091 us/op 80.792 us/op 1.00
Container {a,b,vec} - as tree x100000 1.0093 ms/op 1.0053 ms/op 1.00
Container {a,vec,b} - as struct x100000 121.48 us/op 121.03 us/op 1.00
Container {a,vec,b} - as tree x100000 1.0870 ms/op 1.0856 ms/op 1.00
get 2 props x1000000 - rawObject 403.24 us/op 402.46 us/op 1.00
get 2 props x1000000 - proxy 161.18 ms/op 160.40 ms/op 1.00
get 2 props x1000000 - customObj 403.21 us/op 402.51 us/op 1.00
Simple object binary -> struct 979.00 ns/op 1.4330 us/op 0.68
Simple object binary -> tree_backed 2.8520 us/op 4.4150 us/op 0.65
Simple object struct -> tree_backed 3.9770 us/op 5.9690 us/op 0.67
Simple object tree_backed -> struct 3.3590 us/op 4.7920 us/op 0.70
Simple object struct -> binary 1.8600 us/op 2.4740 us/op 0.75
Simple object tree_backed -> binary 3.1630 us/op 3.6850 us/op 0.86
aggregationBits binary -> struct 823.00 ns/op 1.4860 us/op 0.55
aggregationBits binary -> tree_backed 4.2450 us/op 6.0220 us/op 0.70
aggregationBits struct -> tree_backed 5.3120 us/op 7.6460 us/op 0.69
aggregationBits tree_backed -> struct 2.1990 us/op 2.9720 us/op 0.74
aggregationBits struct -> binary 1.6380 us/op 2.1240 us/op 0.77
aggregationBits tree_backed -> binary 1.9720 us/op 2.6320 us/op 0.75
List(uint8) 100000 binary -> struct 2.3683 ms/op 3.5997 ms/op 0.66
List(uint8) 100000 binary -> tree_backed 201.07 us/op 306.87 us/op 0.66
List(uint8) 100000 struct -> tree_backed 2.5510 ms/op 2.9589 ms/op 0.86
List(uint8) 100000 tree_backed -> struct 1.7876 ms/op 1.9749 ms/op 0.91
List(uint8) 100000 struct -> binary 2.2982 ms/op 2.5539 ms/op 0.90
List(uint8) 100000 tree_backed -> binary 170.66 us/op 182.90 us/op 0.93
List(uint64Number) 100000 binary -> struct 1.9710 ms/op 2.0469 ms/op 0.96
List(uint64Number) 100000 binary -> tree_backed 6.5315 ms/op 7.5358 ms/op 0.87
List(uint64Number) 100000 struct -> tree_backed 9.2147 ms/op 10.240 ms/op 0.90
List(uint64Number) 100000 tree_backed -> struct 4.3799 ms/op 4.9489 ms/op 0.89
List(uint64Number) 100000 struct -> binary 2.7602 ms/op 2.8802 ms/op 0.96
List(uint64Number) 100000 tree_backed -> binary 2.4140 ms/op 2.5061 ms/op 0.96
List(Uint64Bigint) 100000 binary -> struct 6.6229 ms/op 6.7857 ms/op 0.98
List(Uint64Bigint) 100000 binary -> tree_backed 8.0382 ms/op 7.6534 ms/op 1.05
List(Uint64Bigint) 100000 struct -> tree_backed 10.740 ms/op 11.964 ms/op 0.90
List(Uint64Bigint) 100000 tree_backed -> struct 8.4856 ms/op 9.7996 ms/op 0.87
List(Uint64Bigint) 100000 struct -> binary 3.5345 ms/op 4.0787 ms/op 0.87
List(Uint64Bigint) 100000 tree_backed -> binary 2.1986 ms/op 2.9717 ms/op 0.74
Vector(Root) 100000 binary -> struct 64.082 ms/op 77.439 ms/op 0.83
Vector(Root) 100000 binary -> tree_backed 63.357 ms/op 78.852 ms/op 0.80
Vector(Root) 100000 struct -> tree_backed 71.040 ms/op 91.452 ms/op 0.78
Vector(Root) 100000 tree_backed -> struct 76.380 ms/op 104.82 ms/op 0.73
Vector(Root) 100000 struct -> binary 3.6837 ms/op 4.2085 ms/op 0.88
Vector(Root) 100000 tree_backed -> binary 15.313 ms/op 16.961 ms/op 0.90
List(Validator) 100000 binary -> struct 219.53 ms/op 261.48 ms/op 0.84
List(Validator) 100000 binary -> tree_backed 541.00 ms/op 711.77 ms/op 0.76
List(Validator) 100000 struct -> tree_backed 602.54 ms/op 759.36 ms/op 0.79
List(Validator) 100000 tree_backed -> struct 356.23 ms/op 430.43 ms/op 0.83
List(Validator) 100000 struct -> binary 55.926 ms/op 61.976 ms/op 0.90
List(Validator) 100000 tree_backed -> binary 155.13 ms/op 171.61 ms/op 0.90
List(Validator-NS) 100000 binary -> struct 217.48 ms/op 247.93 ms/op 0.88
List(Validator-NS) 100000 binary -> tree_backed 296.24 ms/op 340.67 ms/op 0.87
List(Validator-NS) 100000 struct -> tree_backed 370.88 ms/op 428.84 ms/op 0.86
List(Validator-NS) 100000 tree_backed -> struct 312.32 ms/op 367.71 ms/op 0.85
List(Validator-NS) 100000 struct -> binary 54.075 ms/op 60.897 ms/op 0.89
List(Validator-NS) 100000 tree_backed -> binary 60.845 ms/op 70.759 ms/op 0.86
get epochStatuses - MutableVector 135.62 us/op 184.92 us/op 0.73
get epochStatuses - ViewDU 331.66 us/op 305.03 us/op 1.09
set epochStatuses - ListTreeView 2.4366 ms/op 2.8640 ms/op 0.85
set epochStatuses - ListTreeView - set() 723.18 us/op 806.35 us/op 0.90
set epochStatuses - ListTreeView - commit() 747.72 us/op 841.92 us/op 0.89
bitstring 882.23 ns/op 923.41 ns/op 0.96
bit mask 15.190 ns/op 15.246 ns/op 1.00
struct - increase slot to 1000000 2.6069 ms/op 2.6122 ms/op 1.00
UintNumberType - increase slot to 1000000 57.031 ms/op 58.079 ms/op 0.98
UintBigintType - increase slot to 1000000 725.76 ms/op 723.50 ms/op 1.00
UintBigint8 x 100000 tree_deserialize 8.6959 ms/op 7.6144 ms/op 1.14
UintBigint8 x 100000 tree_serialize 2.4126 ms/op 1.8364 ms/op 1.31
UintBigint16 x 100000 tree_deserialize 8.2847 ms/op 7.2206 ms/op 1.15
UintBigint16 x 100000 tree_serialize 2.4320 ms/op 2.7656 ms/op 0.88
UintBigint32 x 100000 tree_deserialize 8.0898 ms/op 9.4606 ms/op 0.86
UintBigint32 x 100000 tree_serialize 2.1542 ms/op 2.5245 ms/op 0.85
UintBigint64 x 100000 tree_deserialize 9.1253 ms/op 10.171 ms/op 0.90
UintBigint64 x 100000 tree_serialize 2.9021 ms/op 3.2851 ms/op 0.88
UintBigint8 x 100000 value_deserialize 1.0211 ms/op 1.0453 ms/op 0.98
UintBigint8 x 100000 value_serialize 1.2466 ms/op 1.5664 ms/op 0.80
UintBigint16 x 100000 value_deserialize 1.0837 ms/op 1.1021 ms/op 0.98
UintBigint16 x 100000 value_serialize 1.3632 ms/op 1.7198 ms/op 0.79
UintBigint32 x 100000 value_deserialize 985.12 us/op 1.0114 ms/op 0.97
UintBigint32 x 100000 value_serialize 1.4571 ms/op 1.7219 ms/op 0.85
UintBigint64 x 100000 value_deserialize 1.0400 ms/op 1.0887 ms/op 0.96
UintBigint64 x 100000 value_serialize 1.5715 ms/op 1.9753 ms/op 0.80
UintBigint8 x 100000 deserialize 7.8045 ms/op 9.0182 ms/op 0.87
UintBigint8 x 100000 serialize 2.8818 ms/op 3.3793 ms/op 0.85
UintBigint16 x 100000 deserialize 7.7535 ms/op 8.5429 ms/op 0.91
UintBigint16 x 100000 serialize 2.9256 ms/op 3.6209 ms/op 0.81
UintBigint32 x 100000 deserialize 9.1308 ms/op 10.471 ms/op 0.87
UintBigint32 x 100000 serialize 5.1065 ms/op 6.5152 ms/op 0.78
UintBigint64 x 100000 deserialize 6.1803 ms/op 8.0767 ms/op 0.77
UintBigint64 x 100000 serialize 2.8550 ms/op 3.7022 ms/op 0.77
UintBigint128 x 100000 deserialize 9.7766 ms/op 10.521 ms/op 0.93
UintBigint128 x 100000 serialize 31.340 ms/op 34.672 ms/op 0.90
UintBigint256 x 100000 deserialize 17.897 ms/op 21.377 ms/op 0.84
UintBigint256 x 100000 serialize 95.440 ms/op 97.862 ms/op 0.98
Slice from Uint8Array x25000 1.7322 ms/op 2.0429 ms/op 0.85
Slice from ArrayBuffer x25000 31.192 ms/op 37.508 ms/op 0.83
Slice from ArrayBuffer x25000 + new Uint8Array 32.734 ms/op 41.703 ms/op 0.78
Copy Uint8Array 100000 iterate 1.6824 ms/op 1.8911 ms/op 0.89
Copy Uint8Array 100000 slice 239.44 us/op 214.61 us/op 1.12
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 290.85 us/op 191.97 us/op 1.52
Copy Buffer 100000 Uint8Array.prototype.slice.call 328.30 us/op 188.83 us/op 1.74
Copy Uint8Array 100000 slice + set 673.39 us/op 437.35 us/op 1.54
Copy Uint8Array 100000 subarray + set 387.03 us/op 182.25 us/op 2.12
Copy Uint8Array 100000 slice arrayBuffer 417.33 us/op 188.63 us/op 2.21
Uint64 deserialize 100000 - iterate Uint8Array 2.7031 ms/op 2.9855 ms/op 0.91
Uint64 deserialize 100000 - by Uint32A 2.6398 ms/op 2.8687 ms/op 0.92
Uint64 deserialize 100000 - by DataView.getUint32 x2 2.6774 ms/op 2.9292 ms/op 0.91
Uint64 deserialize 100000 - by DataView.getBigUint64 8.1911 ms/op 9.0280 ms/op 0.91
Uint64 deserialize 100000 - by byte 83.762 ms/op 82.662 ms/op 1.01

Please sign in to comment.