Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make all packages build to be consistent and compatible with cjs and esm #426

Merged
merged 31 commits into from
Dec 20, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Make all packages build to be consistent and compatible with cjs and esm

Description

  • Modern tooling required the source code to be in ESM
  • Some of our packages were ESM and some were configured as commonjs.
  • The library build was also inconsistent across all packages in this repo.
  • This PR will configure the repo and all packages to be ESM modules
  • Also build CJS and ESM separately and constantly for all packages

Steps to test or reproduce

Run all tests

@nazarhussain nazarhussain changed the base branch from feature/deno to master December 18, 2024 20:06
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Just a couple small questions

packages/ssz/src/type/container.ts Outdated Show resolved Hide resolved
tsconfig.build.cjs.json Outdated Show resolved Hide resolved
tsconfig.build.esm.json Outdated Show resolved Hide resolved
tsconfig.build.types.json Outdated Show resolved Hide resolved
tsconfig.json Show resolved Hide resolved
Copy link

github-actions bot commented Dec 19, 2024

⚠️ 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: c98bdc8 Previous: b85c774 Ratio
new LeafNode() x7812.5 418.35 us/op 14.757 us/op 28.35
packedRootsBytesToLeafNodes bytes 4000 offset 0 6.4740 us/op 2.1290 us/op 3.04
packedRootsBytesToLeafNodes bytes 4000 offset 1 6.6680 us/op 2.1010 us/op 3.17
packedRootsBytesToLeafNodes bytes 4000 offset 2 6.5000 us/op 2.1210 us/op 3.06
packedRootsBytesToLeafNodes bytes 4000 offset 3 6.8260 us/op 2.1080 us/op 3.24
setNodeWithFn 24.868 ms/op 7.8345 ms/op 3.17
cachePermanentRootStruct no cache 21.202 us/op 5.4560 us/op 3.89
BeaconState ViewDU hashTreeRoot() vc=200000 596.65 ms/op 101.87 ms/op 5.86
BeaconState ViewDU batchHashTreeRoot vc=200000 454.40 ms/op 92.554 ms/op 4.91
BeaconState ViewDU hashTreeRoot - commit step vc=200000 394.14 ms/op 78.884 ms/op 5.00
BeaconState ViewDU hashTreeRoot - hash step vc=200000 73.732 ms/op 14.985 ms/op 4.92
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 1.1015 ms/op 351.09 us/op 3.14
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 1.1189 ms/op 352.45 us/op 3.17
hashTreeRoot Attestation - struct 72.327 us/op 23.982 us/op 3.02
hashTreeRoot Attestation - tree 77.970 us/op 9.3390 us/op 8.35
hashTreeRoot SignedAggregateAndProof - struct 106.38 us/op 27.461 us/op 3.87
hashTreeRoot SignedAggregateAndProof - tree 106.30 us/op 12.785 us/op 8.31
hashTreeRoot SyncCommitteeMessage - struct 23.594 us/op 7.1710 us/op 3.29
hashTreeRoot SyncCommitteeMessage - tree 27.612 us/op 3.1890 us/op 8.66
hashTreeRoot SignedContributionAndProof - struct 69.987 us/op 16.279 us/op 4.30
hashTreeRoot SignedContributionAndProof - tree 83.402 us/op 8.8600 us/op 9.41
hashTreeRoot SignedBeaconBlock - struct 6.5710 ms/op 1.3098 ms/op 5.02
hashTreeRoot SignedBeaconBlock - tree 6.5632 ms/op 769.95 us/op 8.52
hashTreeRoot Validator - struct 29.154 us/op 7.8960 us/op 3.69
hashTreeRoot Validator - tree 35.031 us/op 6.4460 us/op 5.43
BeaconState vc 300000 - hashTreeRoot tree 13.456 s/op 2.1253 s/op 6.33
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 4.8130 us/op 1000.0 ns/op 4.81
BeaconState.validators vc 300000 - hashTreeRoot tree 13.100 s/op 2.0762 s/op 6.31
BeaconState.balances vc 300000 - hashTreeRoot tree 338.08 ms/op 32.424 ms/op 10.43
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 43.641 ms/op 4.0562 ms/op 10.76
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 42.050 ms/op 4.0246 ms/op 10.45
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 341.50 ms/op 36.705 ms/op 9.30
hash64 x18 56.775 us/op 10.087 us/op 5.63
hashTwoObjects x18 77.645 us/op 8.7350 us/op 8.89
hash64 x1740 5.2185 ms/op 813.85 us/op 6.41
hashTwoObjects x1740 7.2996 ms/op 792.83 us/op 9.21
hash64 x2700000 8.2158 s/op 1.2765 s/op 6.44
hashTwoObjects x2700000 11.707 s/op 1.2532 s/op 9.34
set_exitEpoch_and_hashTreeRoot - ContainerType 14.698 us/op 2.5340 us/op 5.80
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 37.510 us/op 6.7930 us/op 5.52
List(uint8) 100000 binary -> tree_backed 313.29 us/op 93.457 us/op 3.35

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: c98bdc8 Previous: b85c774 Ratio
getNodeAtDepth depth 0 x100000 284.96 us/op 1.1311 ms/op 0.25
getNodesAtDepth depth 0 x100000 311.81 us/op 1.0529 ms/op 0.30
getNodeAtDepth depth 1 x100000 342.49 us/op 1.1853 ms/op 0.29
Full benchmark results
Benchmark suite Current: c98bdc8 Previous: b85c774 Ratio
digestTwoHashObjects 50023 times 49.074 ms/op 48.536 ms/op 1.01
digest64 50023 times 53.923 ms/op 53.508 ms/op 1.01
digest 50023 times 60.539 ms/op 55.222 ms/op 1.10
input length 32 1.3400 us/op 1.2570 us/op 1.07
input length 64 1.4590 us/op 1.3470 us/op 1.08
input length 128 2.3820 us/op 2.2830 us/op 1.04
input length 256 3.5780 us/op 3.3960 us/op 1.05
input length 512 5.7580 us/op 5.6350 us/op 1.02
input length 1024 11.142 us/op 10.798 us/op 1.03
digest 1000000 times 980.85 ms/op 878.26 ms/op 1.12
hashObjectToByteArray 50023 times 1.2454 ms/op 1.7190 ms/op 0.72
byteArrayToHashObject 50023 times 1.8499 ms/op 2.3234 ms/op 0.80
digest64 200092 times 226.57 ms/op 216.85 ms/op 1.04
hash 200092 times using batchHash4UintArray64s 260.47 ms/op 236.53 ms/op 1.10
digest64HashObjects 200092 times 217.67 ms/op 195.25 ms/op 1.11
hash 200092 times using batchHash4HashObjectInputs 228.75 ms/op 203.70 ms/op 1.12
getGindicesAtDepth 4.2950 us/op 4.2560 us/op 1.01
iterateAtDepth 7.8980 us/op 7.7310 us/op 1.02
getGindexBits 471.00 ns/op 470.00 ns/op 1.00
gindexIterator 1.0940 us/op 1.0910 us/op 1.00
HashComputationLevel.push then loop 33.769 ms/op 27.975 ms/op 1.21
HashComputation[] push then loop 49.721 ms/op 48.481 ms/op 1.03
hash 2 Uint8Array 500000 times - as-sha256 553.72 ms/op 544.36 ms/op 1.02
hashTwoObjects 500000 times - as-sha256 507.47 ms/op 511.80 ms/op 0.99
executeHashComputations - as-sha256 47.100 ms/op 45.956 ms/op 1.02
hash 2 Uint8Array 500000 times - noble 1.3778 s/op 1.1845 s/op 1.16
hashTwoObjects 500000 times - noble 1.9727 s/op 1.6264 s/op 1.21
executeHashComputations - noble 39.106 ms/op 41.576 ms/op 0.94
hash 2 Uint8Array 500000 times - hashtree 232.47 ms/op 222.41 ms/op 1.05
hashTwoObjects 500000 times - hashtree 224.47 ms/op 214.51 ms/op 1.05
executeHashComputations - hashtree 9.9610 ms/op 11.231 ms/op 0.89
getHashComputations 2.7907 ms/op 2.8547 ms/op 0.98
executeHashComputations 9.8921 ms/op 11.876 ms/op 0.83
get root 15.902 ms/op 16.253 ms/op 0.98
getNodeH() x7812.5 avg hindex 12.274 us/op 12.155 us/op 1.01
getNodeH() x7812.5 index 0 7.6270 us/op 6.2880 us/op 1.21
getNodeH() x7812.5 index 7 7.5130 us/op 6.2560 us/op 1.20
getNodeH() x7812.5 index 7 with key array 6.3370 us/op 6.2610 us/op 1.01
new LeafNode() x7812.5 418.35 us/op 14.757 us/op 28.35
getHashComputations 250000 nodes 16.992 ms/op 19.764 ms/op 0.86
batchHash 250000 nodes 94.264 ms/op 88.754 ms/op 1.06
get root 250000 nodes 118.36 ms/op 114.77 ms/op 1.03
getHashComputations 500000 nodes 32.011 ms/op 29.380 ms/op 1.09
batchHash 500000 nodes 159.48 ms/op 151.99 ms/op 1.05
get root 500000 nodes 245.36 ms/op 239.31 ms/op 1.03
getHashComputations 1000000 nodes 65.554 ms/op 86.429 ms/op 0.76
batchHash 1000000 nodes 347.67 ms/op 348.27 ms/op 1.00
get root 1000000 nodes 483.68 ms/op 453.36 ms/op 1.07
multiproof - depth 15, 1 requested leaves 8.9430 us/op 8.5830 us/op 1.04
tree offset multiproof - depth 15, 1 requested leaves 19.601 us/op 17.973 us/op 1.09
compact multiproof - depth 15, 1 requested leaves 3.6010 us/op 3.4940 us/op 1.03
multiproof - depth 15, 2 requested leaves 13.102 us/op 12.223 us/op 1.07
tree offset multiproof - depth 15, 2 requested leaves 23.321 us/op 21.601 us/op 1.08
compact multiproof - depth 15, 2 requested leaves 3.5900 us/op 3.5190 us/op 1.02
multiproof - depth 15, 3 requested leaves 17.688 us/op 16.742 us/op 1.06
tree offset multiproof - depth 15, 3 requested leaves 29.326 us/op 27.898 us/op 1.05
compact multiproof - depth 15, 3 requested leaves 4.6970 us/op 4.1800 us/op 1.12
multiproof - depth 15, 4 requested leaves 22.399 us/op 22.017 us/op 1.02
tree offset multiproof - depth 15, 4 requested leaves 36.441 us/op 34.892 us/op 1.04
compact multiproof - depth 15, 4 requested leaves 6.0030 us/op 4.8890 us/op 1.23
packedRootsBytesToLeafNodes bytes 4000 offset 0 6.4740 us/op 2.1290 us/op 3.04
packedRootsBytesToLeafNodes bytes 4000 offset 1 6.6680 us/op 2.1010 us/op 3.17
packedRootsBytesToLeafNodes bytes 4000 offset 2 6.5000 us/op 2.1210 us/op 3.06
packedRootsBytesToLeafNodes bytes 4000 offset 3 6.8260 us/op 2.1080 us/op 3.24
subtreeFillToContents depth 40 count 250000 51.777 ms/op 45.620 ms/op 1.13
setRoot - gindexBitstring 22.092 ms/op 8.7088 ms/op 2.54
setRoot - gindex 24.575 ms/op 9.3895 ms/op 2.62
getRoot - gindexBitstring 2.7985 ms/op 2.5720 ms/op 1.09
getRoot - gindex 3.5280 ms/op 3.2986 ms/op 1.07
getHashObject then setHashObject 28.882 ms/op 10.232 ms/op 2.82
setNodeWithFn 24.868 ms/op 7.8345 ms/op 3.17
getNodeAtDepth depth 0 x100000 284.96 us/op 1.1311 ms/op 0.25
setNodeAtDepth depth 0 x100000 2.7487 ms/op 2.4777 ms/op 1.11
getNodesAtDepth depth 0 x100000 311.81 us/op 1.0529 ms/op 0.30
setNodesAtDepth depth 0 x100000 759.34 us/op 1.5167 ms/op 0.50
getNodeAtDepth depth 1 x100000 342.49 us/op 1.1853 ms/op 0.29
setNodeAtDepth depth 1 x100000 8.9543 ms/op 5.3263 ms/op 1.68
getNodesAtDepth depth 1 x100000 435.92 us/op 1.1778 ms/op 0.37
setNodesAtDepth depth 1 x100000 8.2794 ms/op 4.4690 ms/op 1.85
getNodeAtDepth depth 2 x100000 741.47 us/op 1.4546 ms/op 0.51
setNodeAtDepth depth 2 x100000 18.010 ms/op 9.4026 ms/op 1.92
getNodesAtDepth depth 2 x100000 19.210 ms/op 18.158 ms/op 1.06
setNodesAtDepth depth 2 x100000 25.733 ms/op 13.590 ms/op 1.89
tree.getNodesAtDepth - gindexes 11.225 ms/op 7.2915 ms/op 1.54
tree.getNodesAtDepth - push all nodes 2.4357 ms/op 1.9092 ms/op 1.28
tree.getNodesAtDepth - navigation 311.50 us/op 233.78 us/op 1.33
tree.setNodesAtDepth - indexes 743.07 us/op 427.36 us/op 1.74
set at depth 8 891.00 ns/op 507.00 ns/op 1.76
set at depth 16 1.3280 us/op 650.00 ns/op 2.04
set at depth 32 2.4430 us/op 994.00 ns/op 2.46
iterateNodesAtDepth 8 256 16.053 us/op 13.185 us/op 1.22
getNodesAtDepth 8 256 4.0070 us/op 3.3670 us/op 1.19
iterateNodesAtDepth 16 65536 4.6187 ms/op 4.1300 ms/op 1.12
getNodesAtDepth 16 65536 1.9576 ms/op 1.6244 ms/op 1.21
iterateNodesAtDepth 32 250000 17.050 ms/op 15.374 ms/op 1.11
getNodesAtDepth 32 250000 5.6835 ms/op 4.3443 ms/op 1.31
iterateNodesAtDepth 40 250000 17.868 ms/op 15.390 ms/op 1.16
getNodesAtDepth 40 250000 5.6005 ms/op 4.3523 ms/op 1.29
250000 validators root getter 119.98 ms/op 127.33 ms/op 0.94
250000 validators batchHash() 123.12 ms/op 87.862 ms/op 1.40
250000 validators hashComputations 20.577 ms/op 15.418 ms/op 1.33
bitlist bytes to struct (120,90) 728.00 ns/op 1.0560 us/op 0.69
bitlist bytes to tree (120,90) 3.0040 us/op 3.8980 us/op 0.77
bitlist bytes to struct (2048,2048) 1.2270 us/op 1.4220 us/op 0.86
bitlist bytes to tree (2048,2048) 4.1990 us/op 5.6990 us/op 0.74
ByteListType - deserialize 7.9042 ms/op 8.3725 ms/op 0.94
BasicListType - deserialize 13.919 ms/op 19.068 ms/op 0.73
ByteListType - serialize 7.6932 ms/op 7.6498 ms/op 1.01
BasicListType - serialize 10.463 ms/op 10.823 ms/op 0.97
BasicListType - tree_convertToStruct 26.013 ms/op 31.191 ms/op 0.83
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.1731 ms/op 4.7460 ms/op 1.09
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.4496 ms/op 3.9898 ms/op 1.12
Array.push len 300000 empty Array - number 6.7731 ms/op 6.4853 ms/op 1.04
Array.set len 300000 from new Array - number 1.8627 ms/op 1.7454 ms/op 1.07
Array.set len 300000 - number 6.1291 ms/op 5.2574 ms/op 1.17
Uint8Array.set len 300000 492.14 us/op 471.64 us/op 1.04
Uint32Array.set len 300000 577.66 us/op 538.88 us/op 1.07
Container({a: uint8, b: uint8}) getViewDU x300000 27.789 ms/op 44.601 ms/op 0.62
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 11.629 ms/op 10.931 ms/op 1.06
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 225.12 ms/op 198.91 ms/op 1.13
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 278.89 ms/op 235.32 ms/op 1.19
List(Container) len 300000 ViewDU.get(i) 7.4576 ms/op 6.3482 ms/op 1.17
List(Container) len 300000 ViewDU.getReadonly(i) 7.1294 ms/op 6.1997 ms/op 1.15
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 39.644 ms/op 33.690 ms/op 1.18
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 6.4257 ms/op 5.3752 ms/op 1.20
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 7.6288 ms/op 5.9631 ms/op 1.28
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 7.5028 ms/op 5.8283 ms/op 1.29
Array.push len 300000 empty Array - object 7.0534 ms/op 5.8887 ms/op 1.20
Array.set len 300000 from new Array - object 2.6175 ms/op 2.1849 ms/op 1.20
Array.set len 300000 - object 7.1723 ms/op 5.5874 ms/op 1.28
cachePermanentRootStruct no cache 21.202 us/op 5.4560 us/op 3.89
cachePermanentRootStruct with cache 272.00 ns/op 202.00 ns/op 1.35
epochParticipation len 250000 rws 7813 2.4502 ms/op 2.1532 ms/op 1.14
BeaconState ViewDU hashTreeRoot() vc=200000 596.65 ms/op 101.87 ms/op 5.86
BeaconState ViewDU recursive hash - commit step vc=200000 4.5551 ms/op 4.3848 ms/op 1.04
BeaconState ViewDU validator tree creation vc=10000 42.165 ms/op 34.236 ms/op 1.23
BeaconState ViewDU batchHashTreeRoot vc=200000 454.40 ms/op 92.554 ms/op 4.91
BeaconState ViewDU hashTreeRoot - commit step vc=200000 394.14 ms/op 78.884 ms/op 5.00
BeaconState ViewDU hashTreeRoot - hash step vc=200000 73.732 ms/op 14.985 ms/op 4.92
deserialize Attestation - tree 4.4750 us/op 4.1470 us/op 1.08
deserialize Attestation - struct 2.4510 us/op 1.8640 us/op 1.31
deserialize SignedAggregateAndProof - tree 6.3400 us/op 3.8120 us/op 1.66
deserialize SignedAggregateAndProof - struct 4.0420 us/op 2.9570 us/op 1.37
deserialize SyncCommitteeMessage - tree 1.8070 us/op 1.1210 us/op 1.61
deserialize SyncCommitteeMessage - struct 1.5610 us/op 1.1400 us/op 1.37
deserialize SignedContributionAndProof - tree 3.7680 us/op 2.1480 us/op 1.75
deserialize SignedContributionAndProof - struct 3.0160 us/op 2.2630 us/op 1.33
deserialize SignedBeaconBlock - tree 367.23 us/op 214.56 us/op 1.71
deserialize SignedBeaconBlock - struct 164.86 us/op 118.17 us/op 1.40
BeaconState vc 300000 - deserialize tree 694.57 ms/op 581.90 ms/op 1.19
BeaconState vc 300000 - serialize tree 139.87 ms/op 120.60 ms/op 1.16
BeaconState.historicalRoots vc 300000 - deserialize tree 919.00 ns/op 802.00 ns/op 1.15
BeaconState.historicalRoots vc 300000 - serialize tree 799.00 ns/op 649.00 ns/op 1.23
BeaconState.validators vc 300000 - deserialize tree 649.56 ms/op 576.85 ms/op 1.13
BeaconState.validators vc 300000 - serialize tree 117.60 ms/op 103.76 ms/op 1.13
BeaconState.balances vc 300000 - deserialize tree 27.503 ms/op 22.639 ms/op 1.21
BeaconState.balances vc 300000 - serialize tree 5.2210 ms/op 3.3771 ms/op 1.55
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 1.1015 ms/op 351.09 us/op 3.14
BeaconState.previousEpochParticipation vc 300000 - serialize tree 344.30 us/op 294.11 us/op 1.17
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 1.1189 ms/op 352.45 us/op 3.17
BeaconState.currentEpochParticipation vc 300000 - serialize tree 335.12 us/op 292.25 us/op 1.15
BeaconState.inactivityScores vc 300000 - deserialize tree 26.636 ms/op 22.947 ms/op 1.16
BeaconState.inactivityScores vc 300000 - serialize tree 5.2248 ms/op 3.7328 ms/op 1.40
hashTreeRoot Attestation - struct 72.327 us/op 23.982 us/op 3.02
hashTreeRoot Attestation - tree 77.970 us/op 9.3390 us/op 8.35
hashTreeRoot SignedAggregateAndProof - struct 106.38 us/op 27.461 us/op 3.87
hashTreeRoot SignedAggregateAndProof - tree 106.30 us/op 12.785 us/op 8.31
hashTreeRoot SyncCommitteeMessage - struct 23.594 us/op 7.1710 us/op 3.29
hashTreeRoot SyncCommitteeMessage - tree 27.612 us/op 3.1890 us/op 8.66
hashTreeRoot SignedContributionAndProof - struct 69.987 us/op 16.279 us/op 4.30
hashTreeRoot SignedContributionAndProof - tree 83.402 us/op 8.8600 us/op 9.41
hashTreeRoot SignedBeaconBlock - struct 6.5710 ms/op 1.3098 ms/op 5.02
hashTreeRoot SignedBeaconBlock - tree 6.5632 ms/op 769.95 us/op 8.52
hashTreeRoot Validator - struct 29.154 us/op 7.8960 us/op 3.69
hashTreeRoot Validator - tree 35.031 us/op 6.4460 us/op 5.43
BeaconState vc 300000 - hashTreeRoot tree 13.456 s/op 2.1253 s/op 6.33
BeaconState vc 300000 - batchHashTreeRoot tree 7.0170 s/op 3.4322 s/op 2.04
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 4.8130 us/op 1000.0 ns/op 4.81
BeaconState.validators vc 300000 - hashTreeRoot tree 13.100 s/op 2.0762 s/op 6.31
BeaconState.balances vc 300000 - hashTreeRoot tree 338.08 ms/op 32.424 ms/op 10.43
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 43.641 ms/op 4.0562 ms/op 10.76
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 42.050 ms/op 4.0246 ms/op 10.45
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 341.50 ms/op 36.705 ms/op 9.30
hash64 x18 56.775 us/op 10.087 us/op 5.63
hashTwoObjects x18 77.645 us/op 8.7350 us/op 8.89
hash64 x1740 5.2185 ms/op 813.85 us/op 6.41
hashTwoObjects x1740 7.2996 ms/op 792.83 us/op 9.21
hash64 x2700000 8.2158 s/op 1.2765 s/op 6.44
hashTwoObjects x2700000 11.707 s/op 1.2532 s/op 9.34
get_exitEpoch - ContainerType 353.00 ns/op 218.00 ns/op 1.62
get_exitEpoch - ContainerNodeStructType 331.00 ns/op 218.00 ns/op 1.52
set_exitEpoch - ContainerType 350.00 ns/op 227.00 ns/op 1.54
set_exitEpoch - ContainerNodeStructType 334.00 ns/op 229.00 ns/op 1.46
get_pubkey - ContainerType 1.2160 us/op 874.00 ns/op 1.39
get_pubkey - ContainerNodeStructType 326.00 ns/op 215.00 ns/op 1.52
hashTreeRoot - ContainerType 571.00 ns/op 399.00 ns/op 1.43
hashTreeRoot - ContainerNodeStructType 586.00 ns/op 424.00 ns/op 1.38
createProof - ContainerType 5.4290 us/op 3.9640 us/op 1.37
createProof - ContainerNodeStructType 31.909 us/op 20.130 us/op 1.59
serialize - ContainerType 2.0720 us/op 1.8220 us/op 1.14
serialize - ContainerNodeStructType 1.7280 us/op 1.3470 us/op 1.28
set_exitEpoch_and_hashTreeRoot - ContainerType 14.698 us/op 2.5340 us/op 5.80
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 37.510 us/op 6.7930 us/op 5.52
Array - for of 5.7140 us/op 5.5260 us/op 1.03
Array - for(;;) 5.6800 us/op 5.5120 us/op 1.03
basicListValue.readonlyValuesArray() 6.4141 ms/op 4.2127 ms/op 1.52
basicListValue.readonlyValuesArray() + loop all 6.3194 ms/op 4.3204 ms/op 1.46
compositeListValue.readonlyValuesArray() 36.857 ms/op 25.619 ms/op 1.44
compositeListValue.readonlyValuesArray() + loop all 35.844 ms/op 28.646 ms/op 1.25
Number64UintType - get balances list 4.8389 ms/op 4.1201 ms/op 1.17
Number64UintType - set balances list 10.181 ms/op 10.071 ms/op 1.01
Number64UintType - get and increase 10 then set 39.817 ms/op 40.437 ms/op 0.98
Number64UintType - increase 10 using applyDelta 14.687 ms/op 16.219 ms/op 0.91
Number64UintType - increase 10 using applyDeltaInBatch 14.908 ms/op 15.821 ms/op 0.94
tree_newTreeFromUint64Deltas 24.275 ms/op 15.837 ms/op 1.53
unsafeUint8ArrayToTree 46.129 ms/op 31.503 ms/op 1.46
bitLength(50) 261.00 ns/op 224.00 ns/op 1.17
bitLengthStr(50) 226.00 ns/op 206.00 ns/op 1.10
bitLength(8000) 236.00 ns/op 206.00 ns/op 1.15
bitLengthStr(8000) 266.00 ns/op 260.00 ns/op 1.02
bitLength(250000) 237.00 ns/op 206.00 ns/op 1.15
bitLengthStr(250000) 304.00 ns/op 284.00 ns/op 1.07
floor - Math.floor (53) 1.2484 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.2441 ns/op 1.2402 ns/op 1.00
floor - << 0 (512) 1.2445 ns/op 1.2370 ns/op 1.01
fnIf(0) 1.5539 ns/op 1.5484 ns/op 1.00
fnSwitch(0) 2.1762 ns/op 2.2014 ns/op 0.99
fnObj(0) 1.5681 ns/op 1.5470 ns/op 1.01
fnArr(0) 1.5594 ns/op 1.5471 ns/op 1.01
fnIf(4) 2.1762 ns/op 2.1656 ns/op 1.00
fnSwitch(4) 2.1764 ns/op 2.1653 ns/op 1.01
fnObj(4) 1.5627 ns/op 1.5520 ns/op 1.01
fnArr(4) 1.5619 ns/op 1.5516 ns/op 1.01
fnIf(9) 3.1100 ns/op 3.0919 ns/op 1.01
fnSwitch(9) 2.1848 ns/op 2.1642 ns/op 1.01
fnObj(9) 1.5557 ns/op 1.5467 ns/op 1.01
fnArr(9) 1.5757 ns/op 1.5465 ns/op 1.02
Container {a,b,vec} - as struct x100000 126.09 us/op 123.92 us/op 1.02
Container {a,b,vec} - as tree x100000 536.68 us/op 340.57 us/op 1.58
Container {a,vec,b} - as struct x100000 157.51 us/op 155.13 us/op 1.02
Container {a,vec,b} - as tree x100000 497.48 us/op 371.57 us/op 1.34
get 2 props x1000000 - rawObject 311.20 us/op 309.67 us/op 1.00
get 2 props x1000000 - proxy 73.541 ms/op 72.876 ms/op 1.01
get 2 props x1000000 - customObj 316.40 us/op 309.55 us/op 1.02
Simple object binary -> struct 752.00 ns/op 710.00 ns/op 1.06
Simple object binary -> tree_backed 2.0970 us/op 1.3720 us/op 1.53
Simple object struct -> tree_backed 2.5190 us/op 1.9870 us/op 1.27
Simple object tree_backed -> struct 2.0670 us/op 1.8870 us/op 1.10
Simple object struct -> binary 942.00 ns/op 934.00 ns/op 1.01
Simple object tree_backed -> binary 1.4770 us/op 1.6330 us/op 0.90
aggregationBits binary -> struct 596.00 ns/op 650.00 ns/op 0.92
aggregationBits binary -> tree_backed 2.5440 us/op 2.5040 us/op 1.02
aggregationBits struct -> tree_backed 2.9100 us/op 2.8930 us/op 1.01
aggregationBits tree_backed -> struct 1.1540 us/op 1.2520 us/op 0.92
aggregationBits struct -> binary 819.00 ns/op 809.00 ns/op 1.01
aggregationBits tree_backed -> binary 1.1260 us/op 1.0750 us/op 1.05
List(uint8) 100000 binary -> struct 1.5635 ms/op 1.5750 ms/op 0.99
List(uint8) 100000 binary -> tree_backed 313.29 us/op 93.457 us/op 3.35
List(uint8) 100000 struct -> tree_backed 1.4299 ms/op 1.1718 ms/op 1.22
List(uint8) 100000 tree_backed -> struct 1.0511 ms/op 1.1461 ms/op 0.92
List(uint8) 100000 struct -> binary 1.1052 ms/op 1.0313 ms/op 1.07
List(uint8) 100000 tree_backed -> binary 109.10 us/op 92.057 us/op 1.19
List(uint64Number) 100000 binary -> struct 1.4486 ms/op 1.2073 ms/op 1.20
List(uint64Number) 100000 binary -> tree_backed 5.9768 ms/op 2.4318 ms/op 2.46
List(uint64Number) 100000 struct -> tree_backed 7.4452 ms/op 4.1740 ms/op 1.78
List(uint64Number) 100000 tree_backed -> struct 2.8389 ms/op 2.2072 ms/op 1.29
List(uint64Number) 100000 struct -> binary 1.6168 ms/op 1.3973 ms/op 1.16
List(uint64Number) 100000 tree_backed -> binary 1.0149 ms/op 914.01 us/op 1.11
List(Uint64Bigint) 100000 binary -> struct 4.2467 ms/op 3.5588 ms/op 1.19
List(Uint64Bigint) 100000 binary -> tree_backed 6.0855 ms/op 3.3438 ms/op 1.82
List(Uint64Bigint) 100000 struct -> tree_backed 8.0651 ms/op 4.6908 ms/op 1.72
List(Uint64Bigint) 100000 tree_backed -> struct 5.0067 ms/op 4.2703 ms/op 1.17
List(Uint64Bigint) 100000 struct -> binary 2.0256 ms/op 2.0126 ms/op 1.01
List(Uint64Bigint) 100000 tree_backed -> binary 1.3839 ms/op 951.41 us/op 1.45
Vector(Root) 100000 binary -> struct 42.138 ms/op 31.637 ms/op 1.33
Vector(Root) 100000 binary -> tree_backed 47.659 ms/op 26.588 ms/op 1.79
Vector(Root) 100000 struct -> tree_backed 52.480 ms/op 42.917 ms/op 1.22
Vector(Root) 100000 tree_backed -> struct 52.670 ms/op 49.612 ms/op 1.06
Vector(Root) 100000 struct -> binary 2.7472 ms/op 2.7788 ms/op 0.99
Vector(Root) 100000 tree_backed -> binary 8.0136 ms/op 8.5391 ms/op 0.94
List(Validator) 100000 binary -> struct 140.78 ms/op 103.41 ms/op 1.36
List(Validator) 100000 binary -> tree_backed 421.12 ms/op 275.64 ms/op 1.53
List(Validator) 100000 struct -> tree_backed 456.77 ms/op 310.87 ms/op 1.47
List(Validator) 100000 tree_backed -> struct 214.57 ms/op 211.56 ms/op 1.01
List(Validator) 100000 struct -> binary 29.516 ms/op 27.227 ms/op 1.08
List(Validator) 100000 tree_backed -> binary 100.14 ms/op 111.06 ms/op 0.90
List(Validator-NS) 100000 binary -> struct 148.85 ms/op 107.96 ms/op 1.38
List(Validator-NS) 100000 binary -> tree_backed 208.07 ms/op 132.67 ms/op 1.57
List(Validator-NS) 100000 struct -> tree_backed 239.70 ms/op 197.03 ms/op 1.22
List(Validator-NS) 100000 tree_backed -> struct 183.90 ms/op 168.35 ms/op 1.09
List(Validator-NS) 100000 struct -> binary 29.797 ms/op 27.103 ms/op 1.10
List(Validator-NS) 100000 tree_backed -> binary 35.228 ms/op 34.881 ms/op 1.01
get epochStatuses - MutableVector 94.546 us/op 97.303 us/op 0.97
get epochStatuses - ViewDU 175.77 us/op 200.64 us/op 0.88
set epochStatuses - ListTreeView 2.1364 ms/op 2.4405 ms/op 0.88
set epochStatuses - ListTreeView - set() 439.43 us/op 436.55 us/op 1.01
set epochStatuses - ListTreeView - commit() 814.72 us/op 535.09 us/op 1.52
bitstring 513.47 ns/op 634.23 ns/op 0.81
bit mask 13.401 ns/op 14.174 ns/op 0.95
struct - increase slot to 1000000 932.45 us/op 927.78 us/op 1.01
UintNumberType - increase slot to 1000000 26.807 ms/op 21.532 ms/op 1.24
UintBigintType - increase slot to 1000000 184.02 ms/op 165.80 ms/op 1.11
UintBigint8 x 100000 tree_deserialize 5.3411 ms/op 5.3078 ms/op 1.01
UintBigint8 x 100000 tree_serialize 617.11 us/op 1.1525 ms/op 0.54
UintBigint16 x 100000 tree_deserialize 5.7584 ms/op 4.4636 ms/op 1.29
UintBigint16 x 100000 tree_serialize 1.5053 ms/op 1.1993 ms/op 1.26
UintBigint32 x 100000 tree_deserialize 5.8508 ms/op 4.7785 ms/op 1.22
UintBigint32 x 100000 tree_serialize 1.8519 ms/op 1.2069 ms/op 1.53
UintBigint64 x 100000 tree_deserialize 6.7391 ms/op 5.4742 ms/op 1.23
UintBigint64 x 100000 tree_serialize 1.9016 ms/op 1.5943 ms/op 1.19
UintBigint8 x 100000 value_deserialize 436.40 us/op 433.56 us/op 1.01
UintBigint8 x 100000 value_serialize 754.23 us/op 650.98 us/op 1.16
UintBigint16 x 100000 value_deserialize 467.21 us/op 464.34 us/op 1.01
UintBigint16 x 100000 value_serialize 889.20 us/op 681.64 us/op 1.30
UintBigint32 x 100000 value_deserialize 497.85 us/op 433.10 us/op 1.15
UintBigint32 x 100000 value_serialize 913.26 us/op 720.41 us/op 1.27
UintBigint64 x 100000 value_deserialize 566.79 us/op 496.29 us/op 1.14
UintBigint64 x 100000 value_serialize 1.1781 ms/op 900.86 us/op 1.31
UintBigint8 x 100000 deserialize 3.2656 ms/op 2.8535 ms/op 1.14
UintBigint8 x 100000 serialize 1.5359 ms/op 1.7818 ms/op 0.86
UintBigint16 x 100000 deserialize 3.6389 ms/op 2.8839 ms/op 1.26
UintBigint16 x 100000 serialize 1.5932 ms/op 1.4988 ms/op 1.06
UintBigint32 x 100000 deserialize 3.3479 ms/op 2.9676 ms/op 1.13
UintBigint32 x 100000 serialize 3.2360 ms/op 2.6620 ms/op 1.22
UintBigint64 x 100000 deserialize 4.4791 ms/op 3.9316 ms/op 1.14
UintBigint64 x 100000 serialize 1.6247 ms/op 1.5189 ms/op 1.07
UintBigint128 x 100000 deserialize 6.2573 ms/op 4.9649 ms/op 1.26
UintBigint128 x 100000 serialize 14.854 ms/op 13.794 ms/op 1.08
UintBigint256 x 100000 deserialize 8.3959 ms/op 7.7769 ms/op 1.08
UintBigint256 x 100000 serialize 44.977 ms/op 41.308 ms/op 1.09
Slice from Uint8Array x25000 1.3374 ms/op 1.2228 ms/op 1.09
Slice from ArrayBuffer x25000 16.524 ms/op 15.136 ms/op 1.09
Slice from ArrayBuffer x25000 + new Uint8Array 17.943 ms/op 15.596 ms/op 1.15
Copy Uint8Array 100000 iterate 2.6600 ms/op 2.5895 ms/op 1.03
Copy Uint8Array 100000 slice 104.90 us/op 124.44 us/op 0.84
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 105.22 us/op 123.96 us/op 0.85
Copy Buffer 100000 Uint8Array.prototype.slice.call 104.30 us/op 124.16 us/op 0.84
Copy Uint8Array 100000 slice + set 206.33 us/op 192.06 us/op 1.07
Copy Uint8Array 100000 subarray + set 104.08 us/op 122.50 us/op 0.85
Copy Uint8Array 100000 slice arrayBuffer 107.50 us/op 122.22 us/op 0.88
Uint64 deserialize 100000 - iterate Uint8Array 2.0028 ms/op 1.7530 ms/op 1.14
Uint64 deserialize 100000 - by Uint32A 2.0260 ms/op 1.8819 ms/op 1.08
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.9690 ms/op 1.7765 ms/op 1.11
Uint64 deserialize 100000 - by DataView.getBigUint64 5.1105 ms/op 4.7748 ms/op 1.07
Uint64 deserialize 100000 - by byte 40.819 ms/op 40.276 ms/op 1.01

by benchmarkbot/action

@nazarhussain nazarhussain self-assigned this Dec 20, 2024
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Hooray!!!! LGTM 🚀

@nazarhussain nazarhussain merged commit 67bcd88 into master Dec 20, 2024
7 checks passed
@nazarhussain nazarhussain deleted the nh/esm-cjs-builds branch December 20, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants