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

feat: implement batch hash utils #384

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jul 16, 2024

Motivation

Description

  • consume @chainsafe/hashtree, see hashtree.ts
  • Model HashComputations to compute a parent hash from 2 child nodes
    • getHashComputations() to populate HashComputations[][]
    • executeHashComputations() execute HashComputations from bottom nodes up until the root node, this is part of hasher api
  • other new methods for hashers:
    • merkleizeInto: merkleize() without memory allocation, pad zeroHash[i] in the middle if needed
    • digestNLevel: hash every 64 bytes up until some level, used when we want to hash multiple validators at the same time (later)
  • modify setNodesAtDepth() function by adding an output param to compute HashComputations, this saves one traversal from the consumer

part of #355

Copy link

github-actions bot commented Jul 16, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: d7204e7 Previous: ccadf43 Ratio
digestTwoHashObjects 50023 times 48.325 ms/op 48.606 ms/op 0.99
digest64 50023 times 50.887 ms/op 50.950 ms/op 1.00
digest 50023 times 55.091 ms/op 53.682 ms/op 1.03
input length 32 1.1940 us/op 1.2050 us/op 0.99
input length 64 1.3380 us/op 1.3650 us/op 0.98
input length 128 2.3350 us/op 2.2600 us/op 1.03
input length 256 3.5790 us/op 3.3520 us/op 1.07
input length 512 5.9780 us/op 5.5720 us/op 1.07
input length 1024 11.354 us/op 10.762 us/op 1.06
digest 1000000 times 862.65 ms/op 823.93 ms/op 1.05
hashObjectToByteArray 50023 times 1.4297 ms/op 1.4284 ms/op 1.00
byteArrayToHashObject 50023 times 2.6786 ms/op 2.7902 ms/op 0.96
digest64 200092 times 220.04 ms/op 209.32 ms/op 1.05
hash 200092 times using batchHash4UintArray64s 224.44 ms/op 215.35 ms/op 1.04
digest64HashObjects 200092 times 205.51 ms/op 196.76 ms/op 1.04
hash 200092 times using batchHash4HashObjectInputs 213.69 ms/op 200.27 ms/op 1.07
getGindicesAtDepth 4.4650 us/op 4.6060 us/op 0.97
iterateAtDepth 8.1070 us/op 8.3630 us/op 0.97
getGindexBits 501.00 ns/op 502.00 ns/op 1.00
gindexIterator 1.1330 us/op 1.1460 us/op 0.99
hash 2 Uint8Array 500000 times - as-sha256 548.05 ms/op
hashTwoObjects 500000 times - as-sha256 508.10 ms/op
executeHashComputations - as-sha256 47.234 ms/op
hash 2 Uint8Array 500000 times - noble 1.1779 s/op
hashTwoObjects 500000 times - noble 1.7429 s/op
executeHashComputations - noble 46.937 ms/op
hash 2 Uint8Array 500000 times - hashtree 242.80 ms/op
hashTwoObjects 500000 times - hashtree 219.23 ms/op
executeHashComputations - hashtree 12.034 ms/op
getNodeH() x7812.5 avg hindex 12.128 us/op 12.108 us/op 1.00
getNodeH() x7812.5 index 0 6.3640 us/op 6.3560 us/op 1.00
getNodeH() x7812.5 index 7 6.3020 us/op 6.3540 us/op 0.99
getNodeH() x7812.5 index 7 with key array 6.2890 us/op 6.4700 us/op 0.97
new LeafNode() x7812.5 14.678 us/op 14.850 us/op 0.99
getHashComputations 250000 nodes 28.247 ms/op
batchHash 250000 nodes 352.58 ms/op
get root 250000 nodes 902.10 ms/op
getHashComputations 500000 nodes 75.313 ms/op
batchHash 500000 nodes 681.24 ms/op
get root 500000 nodes 1.7686 s/op
getHashComputations 1000000 nodes 117.86 ms/op
batchHash 1000000 nodes 1.2618 s/op
get root 1000000 nodes 3.4912 s/op
multiproof - depth 15, 1 requested leaves 8.9170 us/op 8.8150 us/op 1.01
tree offset multiproof - depth 15, 1 requested leaves 19.535 us/op 19.502 us/op 1.00
compact multiproof - depth 15, 1 requested leaves 3.9150 us/op 3.6980 us/op 1.06
multiproof - depth 15, 2 requested leaves 12.917 us/op 11.821 us/op 1.09
tree offset multiproof - depth 15, 2 requested leaves 23.506 us/op 21.988 us/op 1.07
compact multiproof - depth 15, 2 requested leaves 3.7490 us/op 3.5160 us/op 1.07
multiproof - depth 15, 3 requested leaves 17.688 us/op 16.803 us/op 1.05
tree offset multiproof - depth 15, 3 requested leaves 29.516 us/op 27.799 us/op 1.06
compact multiproof - depth 15, 3 requested leaves 4.4960 us/op 4.4720 us/op 1.01
multiproof - depth 15, 4 requested leaves 23.575 us/op 22.136 us/op 1.07
tree offset multiproof - depth 15, 4 requested leaves 38.269 us/op 34.273 us/op 1.12
compact multiproof - depth 15, 4 requested leaves 6.2640 us/op 5.1960 us/op 1.21
packedRootsBytesToLeafNodes bytes 4000 offset 0 1.8530 us/op 2.0340 us/op 0.91
packedRootsBytesToLeafNodes bytes 4000 offset 1 1.8320 us/op 2.0280 us/op 0.90
packedRootsBytesToLeafNodes bytes 4000 offset 2 1.9290 us/op 2.0350 us/op 0.95
packedRootsBytesToLeafNodes bytes 4000 offset 3 1.7960 us/op 2.0290 us/op 0.89
subtreeFillToContents depth 40 count 250000 44.551 ms/op 47.273 ms/op 0.94
setRoot - gindexBitstring 9.2776 ms/op 8.8759 ms/op 1.05
setRoot - gindex 9.5346 ms/op 9.1587 ms/op 1.04
getRoot - gindexBitstring 2.6260 ms/op 2.4483 ms/op 1.07
getRoot - gindex 3.4930 ms/op 3.2910 ms/op 1.06
getHashObject then setHashObject 10.287 ms/op 10.403 ms/op 0.99
setNodeWithFn 7.7213 ms/op 7.9493 ms/op 0.97
getNodeAtDepth depth 0 x100000 1.1131 ms/op 1.1153 ms/op 1.00
setNodeAtDepth depth 0 x100000 2.3926 ms/op 2.3929 ms/op 1.00
getNodesAtDepth depth 0 x100000 1.0545 ms/op 1.0530 ms/op 1.00
setNodesAtDepth depth 0 x100000 1.4922 ms/op 1.4550 ms/op 1.03
getNodeAtDepth depth 1 x100000 1.1783 ms/op 1.1817 ms/op 1.00
setNodeAtDepth depth 1 x100000 5.2336 ms/op 5.1739 ms/op 1.01
getNodesAtDepth depth 1 x100000 1.1765 ms/op 1.1768 ms/op 1.00
setNodesAtDepth depth 1 x100000 4.6952 ms/op 4.7890 ms/op 0.98
getNodeAtDepth depth 2 x100000 1.4554 ms/op 1.4557 ms/op 1.00
setNodeAtDepth depth 2 x100000 9.0486 ms/op 8.7840 ms/op 1.03
getNodesAtDepth depth 2 x100000 17.901 ms/op 17.879 ms/op 1.00
setNodesAtDepth depth 2 x100000 14.629 ms/op 13.097 ms/op 1.12
tree.getNodesAtDepth - gindexes 9.3696 ms/op 7.8988 ms/op 1.19
tree.getNodesAtDepth - push all nodes 1.8852 ms/op 1.9720 ms/op 0.96
tree.getNodesAtDepth - navigation 234.03 us/op 233.19 us/op 1.00
tree.setNodesAtDepth - indexes 406.66 us/op 397.95 us/op 1.02
set at depth 8 497.00 ns/op 451.00 ns/op 1.10
set at depth 16 659.00 ns/op 597.00 ns/op 1.10
set at depth 32 943.00 ns/op 950.00 ns/op 0.99
iterateNodesAtDepth 8 256 13.893 us/op 13.425 us/op 1.03
getNodesAtDepth 8 256 3.6510 us/op 3.4360 us/op 1.06
iterateNodesAtDepth 16 65536 4.4027 ms/op 4.3787 ms/op 1.01
getNodesAtDepth 16 65536 1.5532 ms/op 1.6358 ms/op 0.95
iterateNodesAtDepth 32 250000 16.109 ms/op 15.667 ms/op 1.03
getNodesAtDepth 32 250000 4.6977 ms/op 4.3703 ms/op 1.07
iterateNodesAtDepth 40 250000 16.066 ms/op 15.556 ms/op 1.03
getNodesAtDepth 40 250000 4.4606 ms/op 4.3841 ms/op 1.02
1600000 validators root getter 5.6106 s/op
1600000 validators batchHash() 1.9642 s/op
1600000 validators hashComputations 221.82 ms/op
bitlist bytes to struct (120,90) 537.00 ns/op 486.00 ns/op 1.10
bitlist bytes to tree (120,90) 2.3880 us/op 2.1970 us/op 1.09
bitlist bytes to struct (2048,2048) 1.1560 us/op 929.00 ns/op 1.24
bitlist bytes to tree (2048,2048) 4.2330 us/op 3.3960 us/op 1.25
ByteListType - deserialize 9.9922 ms/op 7.4096 ms/op 1.35
BasicListType - deserialize 13.822 ms/op 12.156 ms/op 1.14
ByteListType - serialize 9.9380 ms/op 7.6933 ms/op 1.29
BasicListType - serialize 13.386 ms/op 9.6969 ms/op 1.38
BasicListType - tree_convertToStruct 22.220 ms/op 22.786 ms/op 0.98
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.8767 ms/op 4.3648 ms/op 1.12
List[uint8, 68719476736] len 300000 ViewDU.get(i) 2.7778 ms/op 3.9838 ms/op 0.70
Array.push len 300000 empty Array - number 7.4643 ms/op 6.0339 ms/op 1.24
Array.set len 300000 from new Array - number 2.2163 ms/op 1.9156 ms/op 1.16
Array.set len 300000 - number 7.0450 ms/op 5.8151 ms/op 1.21
Uint8Array.set len 300000 401.21 us/op 379.28 us/op 1.06
Uint32Array.set len 300000 533.21 us/op 462.82 us/op 1.15
Container({a: uint8, b: uint8}) getViewDU x300000 72.419 ms/op 50.728 ms/op 1.43
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.728 ms/op 10.717 ms/op 1.19
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 200.31 ms/op 208.06 ms/op 0.96
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 275.24 ms/op 249.72 ms/op 1.10
List(Container) len 300000 ViewDU.get(i) 6.9222 ms/op 6.4371 ms/op 1.08
List(Container) len 300000 ViewDU.getReadonly(i) 6.5084 ms/op 6.3626 ms/op 1.02
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 33.735 ms/op 38.353 ms/op 0.88
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.8423 ms/op 5.5205 ms/op 1.06
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.3519 ms/op 6.2475 ms/op 1.02
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.4468 ms/op 5.9934 ms/op 1.08
Array.push len 300000 empty Array - object 6.7990 ms/op 6.3785 ms/op 1.07
Array.set len 300000 from new Array - object 1.9267 ms/op 2.2398 ms/op 0.86
Array.set len 300000 - object 6.2614 ms/op 5.9680 ms/op 1.05
cachePermanentRootStruct no cache 9.0080 us/op 8.8730 us/op 1.02
cachePermanentRootStruct with cache 242.00 ns/op 205.00 ns/op 1.18
epochParticipation len 250000 rws 7813 2.2832 ms/op 2.2732 ms/op 1.00
deserialize Attestation - tree 4.2420 us/op 4.2900 us/op 0.99
deserialize Attestation - struct 1.8820 us/op 1.8230 us/op 1.03
deserialize SignedAggregateAndProof - tree 3.8970 us/op 3.7260 us/op 1.05
deserialize SignedAggregateAndProof - struct 3.0370 us/op 3.0380 us/op 1.00
deserialize SyncCommitteeMessage - tree 1.1500 us/op 1.0830 us/op 1.06
deserialize SyncCommitteeMessage - struct 1.1280 us/op 1.1350 us/op 0.99
deserialize SignedContributionAndProof - tree 2.1080 us/op 2.0270 us/op 1.04
deserialize SignedContributionAndProof - struct 2.4340 us/op 2.3240 us/op 1.05
deserialize SignedBeaconBlock - tree 218.20 us/op 208.46 us/op 1.05
deserialize SignedBeaconBlock - struct 124.84 us/op 116.70 us/op 1.07
BeaconState vc 300000 - deserialize tree 582.57 ms/op 562.05 ms/op 1.04
BeaconState vc 300000 - serialize tree 114.13 ms/op 128.37 ms/op 0.89
BeaconState.historicalRoots vc 300000 - deserialize tree 816.00 ns/op 735.00 ns/op 1.11
BeaconState.historicalRoots vc 300000 - serialize tree 707.00 ns/op 626.00 ns/op 1.13
BeaconState.validators vc 300000 - deserialize tree 530.94 ms/op 510.73 ms/op 1.04
BeaconState.validators vc 300000 - serialize tree 95.185 ms/op 100.15 ms/op 0.95
BeaconState.balances vc 300000 - deserialize tree 21.036 ms/op 18.403 ms/op 1.14
BeaconState.balances vc 300000 - serialize tree 4.5932 ms/op 4.4346 ms/op 1.04
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 599.65 us/op 493.12 us/op 1.22
BeaconState.previousEpochParticipation vc 300000 - serialize tree 289.09 us/op 270.08 us/op 1.07
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 630.69 us/op 454.45 us/op 1.39
BeaconState.currentEpochParticipation vc 300000 - serialize tree 297.96 us/op 285.07 us/op 1.05
BeaconState.inactivityScores vc 300000 - deserialize tree 21.475 ms/op 21.278 ms/op 1.01
BeaconState.inactivityScores vc 300000 - serialize tree 4.8068 ms/op 3.1531 ms/op 1.52
hashTreeRoot Attestation - struct 32.745 us/op 25.939 us/op 1.26
hashTreeRoot Attestation - tree 22.505 us/op 18.457 us/op 1.22
hashTreeRoot SignedAggregateAndProof - struct 45.951 us/op 37.971 us/op 1.21
hashTreeRoot SignedAggregateAndProof - tree 30.340 us/op 28.527 us/op 1.06
hashTreeRoot SyncCommitteeMessage - struct 10.950 us/op 9.2980 us/op 1.18
hashTreeRoot SyncCommitteeMessage - tree 6.9760 us/op 6.3550 us/op 1.10
hashTreeRoot SignedContributionAndProof - struct 30.492 us/op 25.665 us/op 1.19
hashTreeRoot SignedContributionAndProof - tree 20.996 us/op 19.884 us/op 1.06
hashTreeRoot SignedBeaconBlock - struct 2.6407 ms/op 2.2678 ms/op 1.16
hashTreeRoot SignedBeaconBlock - tree 1.9003 ms/op 1.6905 ms/op 1.12
hashTreeRoot Validator - struct 13.698 us/op 12.109 us/op 1.13
hashTreeRoot Validator - tree 12.891 us/op 10.705 us/op 1.20
BeaconState vc 300000 - hashTreeRoot tree 3.9650 s/op 3.6138 s/op 1.10
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.6050 us/op 1.3080 us/op 1.23
BeaconState.validators vc 300000 - hashTreeRoot tree 3.7774 s/op 3.4069 s/op 1.11
BeaconState.balances vc 300000 - hashTreeRoot tree 84.143 ms/op 87.780 ms/op 0.96
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 10.066 ms/op 8.9768 ms/op 1.12
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 10.092 ms/op 8.9506 ms/op 1.13
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 80.563 ms/op 84.066 ms/op 0.96
hash64 x18 19.800 us/op 19.174 us/op 1.03
hashTwoObjects x18 20.118 us/op 18.189 us/op 1.11
hash64 x1740 1.8533 ms/op 1.8549 ms/op 1.00
hashTwoObjects x1740 1.8788 ms/op 1.7240 ms/op 1.09
hash64 x2700000 2.8697 s/op 2.8655 s/op 1.00
hashTwoObjects x2700000 2.9233 s/op 2.6501 s/op 1.10
get_exitEpoch - ContainerType 443.00 ns/op 213.00 ns/op 2.08
get_exitEpoch - ContainerNodeStructType 438.00 ns/op 188.00 ns/op 2.33
set_exitEpoch - ContainerType 465.00 ns/op 213.00 ns/op 2.18
set_exitEpoch - ContainerNodeStructType 436.00 ns/op 198.00 ns/op 2.20
get_pubkey - ContainerType 1.6360 us/op 848.00 ns/op 1.93
get_pubkey - ContainerNodeStructType 435.00 ns/op 193.00 ns/op 2.25
hashTreeRoot - ContainerType 738.00 ns/op 341.00 ns/op 2.16
hashTreeRoot - ContainerNodeStructType 783.00 ns/op 401.00 ns/op 1.95
createProof - ContainerType 5.7000 us/op 3.7320 us/op 1.53
createProof - ContainerNodeStructType 24.759 us/op 19.573 us/op 1.26
serialize - ContainerType 1.9530 us/op 1.7260 us/op 1.13
serialize - ContainerNodeStructType 1.7030 us/op 1.4150 us/op 1.20
set_exitEpoch_and_hashTreeRoot - ContainerType 5.3200 us/op 4.1720 us/op 1.28
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 14.042 us/op 11.041 us/op 1.27
Array - for of 5.7490 us/op 5.6020 us/op 1.03
Array - for(;;) 5.8320 us/op 5.4890 us/op 1.06
basicListValue.readonlyValuesArray() 4.1540 ms/op 4.0438 ms/op 1.03
basicListValue.readonlyValuesArray() + loop all 4.6132 ms/op 4.2351 ms/op 1.09
compositeListValue.readonlyValuesArray() 27.882 ms/op 29.951 ms/op 0.93
compositeListValue.readonlyValuesArray() + loop all 29.141 ms/op 26.424 ms/op 1.10
Number64UintType - get balances list 2.1319 ms/op 4.1206 ms/op 0.52
Number64UintType - set balances list 9.6570 ms/op 10.635 ms/op 0.91
Number64UintType - get and increase 10 then set 31.694 ms/op 38.502 ms/op 0.82
Number64UintType - increase 10 using applyDelta 13.738 ms/op 16.494 ms/op 0.83
Number64UintType - increase 10 using applyDeltaInBatch 13.763 ms/op 16.227 ms/op 0.85
tree_newTreeFromUint64Deltas 17.321 ms/op 14.757 ms/op 1.17
unsafeUint8ArrayToTree 32.767 ms/op 26.603 ms/op 1.23
bitLength(50) 229.00 ns/op 203.00 ns/op 1.13
bitLengthStr(50) 213.00 ns/op 197.00 ns/op 1.08
bitLength(8000) 235.00 ns/op 200.00 ns/op 1.18
bitLengthStr(8000) 251.00 ns/op 245.00 ns/op 1.02
bitLength(250000) 221.00 ns/op 187.00 ns/op 1.18
bitLengthStr(250000) 297.00 ns/op 270.00 ns/op 1.10
floor - Math.floor (53) 1.2366 ns/op 1.2369 ns/op 1.00
floor - << 0 (53) 1.2375 ns/op 1.2369 ns/op 1.00
floor - Math.floor (512) 1.2384 ns/op 1.2403 ns/op 1.00
floor - << 0 (512) 1.2417 ns/op 1.2371 ns/op 1.00
fnIf(0) 1.5532 ns/op 1.5459 ns/op 1.00
fnSwitch(0) 2.1674 ns/op 2.1924 ns/op 0.99
fnObj(0) 1.5547 ns/op 1.5470 ns/op 1.00
fnArr(0) 1.5504 ns/op 1.5471 ns/op 1.00
fnIf(4) 2.1667 ns/op 2.1645 ns/op 1.00
fnSwitch(4) 2.1675 ns/op 2.2230 ns/op 0.98
fnObj(4) 1.5720 ns/op 1.5551 ns/op 1.01
fnArr(4) 1.5484 ns/op 1.5509 ns/op 1.00
fnIf(9) 3.1334 ns/op 3.1187 ns/op 1.00
fnSwitch(9) 2.1670 ns/op 2.1903 ns/op 0.99
fnObj(9) 1.5520 ns/op 1.5462 ns/op 1.00
fnArr(9) 1.5501 ns/op 1.5461 ns/op 1.00
Container {a,b,vec} - as struct x100000 123.90 us/op 123.81 us/op 1.00
Container {a,b,vec} - as tree x100000 340.72 us/op 341.17 us/op 1.00
Container {a,vec,b} - as struct x100000 154.99 us/op 154.84 us/op 1.00
Container {a,vec,b} - as tree x100000 371.66 us/op 372.14 us/op 1.00
get 2 props x1000000 - rawObject 309.93 us/op 309.79 us/op 1.00
get 2 props x1000000 - proxy 72.926 ms/op 72.770 ms/op 1.00
get 2 props x1000000 - customObj 309.92 us/op 313.47 us/op 0.99
Simple object binary -> struct 657.00 ns/op 698.00 ns/op 0.94
Simple object binary -> tree_backed 1.2360 us/op 1.2960 us/op 0.95
Simple object struct -> tree_backed 1.8320 us/op 1.8770 us/op 0.98
Simple object tree_backed -> struct 1.7830 us/op 1.8420 us/op 0.97
Simple object struct -> binary 913.00 ns/op 941.00 ns/op 0.97
Simple object tree_backed -> binary 1.5410 us/op 1.5730 us/op 0.98
aggregationBits binary -> struct 567.00 ns/op 613.00 ns/op 0.92
aggregationBits binary -> tree_backed 2.3500 us/op 2.3220 us/op 1.01
aggregationBits struct -> tree_backed 2.7500 us/op 2.7420 us/op 1.00
aggregationBits tree_backed -> struct 1.1640 us/op 1.2080 us/op 0.96
aggregationBits struct -> binary 757.00 ns/op 813.00 ns/op 0.93
aggregationBits tree_backed -> binary 1.0190 us/op 1.0640 us/op 0.96
List(uint8) 100000 binary -> struct 1.3020 ms/op 1.3424 ms/op 0.97
List(uint8) 100000 binary -> tree_backed 88.714 us/op 87.901 us/op 1.01
List(uint8) 100000 struct -> tree_backed 1.1498 ms/op 1.1335 ms/op 1.01
List(uint8) 100000 tree_backed -> struct 1.0271 ms/op 1.0038 ms/op 1.02
List(uint8) 100000 struct -> binary 992.07 us/op 1.0175 ms/op 0.98
List(uint8) 100000 tree_backed -> binary 87.861 us/op 87.786 us/op 1.00
List(uint64Number) 100000 binary -> struct 1.1824 ms/op 1.1411 ms/op 1.04
List(uint64Number) 100000 binary -> tree_backed 3.0966 ms/op 2.4980 ms/op 1.24
List(uint64Number) 100000 struct -> tree_backed 4.5866 ms/op 4.3696 ms/op 1.05
List(uint64Number) 100000 tree_backed -> struct 2.3332 ms/op 2.1951 ms/op 1.06
List(uint64Number) 100000 struct -> binary 1.5048 ms/op 1.2859 ms/op 1.17
List(uint64Number) 100000 tree_backed -> binary 904.37 us/op 836.73 us/op 1.08
List(Uint64Bigint) 100000 binary -> struct 3.7296 ms/op 3.3192 ms/op 1.12
List(Uint64Bigint) 100000 binary -> tree_backed 3.2000 ms/op 3.0469 ms/op 1.05
List(Uint64Bigint) 100000 struct -> tree_backed 5.4306 ms/op 5.2807 ms/op 1.03
List(Uint64Bigint) 100000 tree_backed -> struct 4.6360 ms/op 4.4418 ms/op 1.04
List(Uint64Bigint) 100000 struct -> binary 2.0369 ms/op 2.0427 ms/op 1.00
List(Uint64Bigint) 100000 tree_backed -> binary 1.0022 ms/op 908.04 us/op 1.10
Vector(Root) 100000 binary -> struct 31.519 ms/op 23.537 ms/op 1.34
Vector(Root) 100000 binary -> tree_backed 31.772 ms/op 27.815 ms/op 1.14
Vector(Root) 100000 struct -> tree_backed 36.646 ms/op 35.522 ms/op 1.03
Vector(Root) 100000 tree_backed -> struct 44.025 ms/op 43.665 ms/op 1.01
Vector(Root) 100000 struct -> binary 2.6167 ms/op 2.5248 ms/op 1.04
Vector(Root) 100000 tree_backed -> binary 10.067 ms/op 9.1012 ms/op 1.11
List(Validator) 100000 binary -> struct 104.05 ms/op 100.83 ms/op 1.03
List(Validator) 100000 binary -> tree_backed 294.96 ms/op 275.96 ms/op 1.07
List(Validator) 100000 struct -> tree_backed 298.33 ms/op 292.11 ms/op 1.02
List(Validator) 100000 tree_backed -> struct 191.25 ms/op 188.56 ms/op 1.01
List(Validator) 100000 struct -> binary 27.172 ms/op 27.859 ms/op 0.98
List(Validator) 100000 tree_backed -> binary 95.603 ms/op 99.126 ms/op 0.96
List(Validator-NS) 100000 binary -> struct 96.764 ms/op 97.140 ms/op 1.00
List(Validator-NS) 100000 binary -> tree_backed 135.46 ms/op 136.27 ms/op 0.99
List(Validator-NS) 100000 struct -> tree_backed 172.41 ms/op 166.35 ms/op 1.04
List(Validator-NS) 100000 tree_backed -> struct 144.99 ms/op 143.42 ms/op 1.01
List(Validator-NS) 100000 struct -> binary 27.084 ms/op 27.818 ms/op 0.97
List(Validator-NS) 100000 tree_backed -> binary 32.001 ms/op 31.893 ms/op 1.00
get epochStatuses - MutableVector 93.385 us/op 91.758 us/op 1.02
get epochStatuses - ViewDU 179.72 us/op 201.79 us/op 0.89
set epochStatuses - ListTreeView 1.6179 ms/op 1.4942 ms/op 1.08
set epochStatuses - ListTreeView - set() 432.67 us/op 440.03 us/op 0.98
set epochStatuses - ListTreeView - commit() 524.11 us/op 506.39 us/op 1.03
bitstring 639.69 ns/op 636.53 ns/op 1.00
bit mask 13.874 ns/op 14.109 ns/op 0.98
struct - increase slot to 1000000 928.30 us/op 928.82 us/op 1.00
UintNumberType - increase slot to 1000000 21.986 ms/op 22.184 ms/op 0.99
UintBigintType - increase slot to 1000000 169.97 ms/op 165.11 ms/op 1.03
UintBigint8 x 100000 tree_deserialize 4.7964 ms/op 4.7547 ms/op 1.01
UintBigint8 x 100000 tree_serialize 540.31 us/op 1.1908 ms/op 0.45
UintBigint16 x 100000 tree_deserialize 4.7928 ms/op 4.1324 ms/op 1.16
UintBigint16 x 100000 tree_serialize 614.19 us/op 1.1225 ms/op 0.55
UintBigint32 x 100000 tree_deserialize 4.9479 ms/op 4.5434 ms/op 1.09
UintBigint32 x 100000 tree_serialize 663.48 us/op 1.1358 ms/op 0.58
UintBigint64 x 100000 tree_deserialize 5.7670 ms/op 5.2753 ms/op 1.09
UintBigint64 x 100000 tree_serialize 1.2580 ms/op 1.4966 ms/op 0.84
UintBigint8 x 100000 value_deserialize 433.15 us/op 433.12 us/op 1.00
UintBigint8 x 100000 value_serialize 870.02 us/op 571.96 us/op 1.52
UintBigint16 x 100000 value_deserialize 463.95 us/op 464.16 us/op 1.00
UintBigint16 x 100000 value_serialize 944.82 us/op 633.28 us/op 1.49
UintBigint32 x 100000 value_deserialize 434.30 us/op 433.07 us/op 1.00
UintBigint32 x 100000 value_serialize 911.54 us/op 607.97 us/op 1.50
UintBigint64 x 100000 value_deserialize 496.82 us/op 496.24 us/op 1.00
UintBigint64 x 100000 value_serialize 1.0828 ms/op 783.52 us/op 1.38
UintBigint8 x 100000 deserialize 3.3025 ms/op 2.8819 ms/op 1.15
UintBigint8 x 100000 serialize 1.7061 ms/op 1.4489 ms/op 1.18
UintBigint16 x 100000 deserialize 3.0346 ms/op 2.9954 ms/op 1.01
UintBigint16 x 100000 serialize 1.4401 ms/op 1.4820 ms/op 0.97
UintBigint32 x 100000 deserialize 3.0471 ms/op 3.0584 ms/op 1.00
UintBigint32 x 100000 serialize 2.7052 ms/op 2.7634 ms/op 0.98
UintBigint64 x 100000 deserialize 3.7955 ms/op 3.9421 ms/op 0.96
UintBigint64 x 100000 serialize 1.5034 ms/op 1.5164 ms/op 0.99
UintBigint128 x 100000 deserialize 5.1478 ms/op 5.0007 ms/op 1.03
UintBigint128 x 100000 serialize 15.357 ms/op 15.019 ms/op 1.02
UintBigint256 x 100000 deserialize 8.4421 ms/op 7.7375 ms/op 1.09
UintBigint256 x 100000 serialize 45.932 ms/op 45.452 ms/op 1.01
Slice from Uint8Array x25000 1.1255 ms/op 1.3017 ms/op 0.86
Slice from ArrayBuffer x25000 16.452 ms/op 16.177 ms/op 1.02
Slice from ArrayBuffer x25000 + new Uint8Array 18.083 ms/op 16.730 ms/op 1.08
Copy Uint8Array 100000 iterate 1.7487 ms/op 1.6601 ms/op 1.05
Copy Uint8Array 100000 slice 117.24 us/op 140.01 us/op 0.84
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 111.64 us/op 138.45 us/op 0.81
Copy Buffer 100000 Uint8Array.prototype.slice.call 112.08 us/op 135.67 us/op 0.83
Copy Uint8Array 100000 slice + set 197.14 us/op 193.54 us/op 1.02
Copy Uint8Array 100000 subarray + set 107.05 us/op 131.44 us/op 0.81
Copy Uint8Array 100000 slice arrayBuffer 109.55 us/op 132.50 us/op 0.83
Uint64 deserialize 100000 - iterate Uint8Array 1.8080 ms/op 1.8556 ms/op 0.97
Uint64 deserialize 100000 - by Uint32A 1.8328 ms/op 1.7487 ms/op 1.05
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.8192 ms/op 1.7661 ms/op 1.03
Uint64 deserialize 100000 - by DataView.getBigUint64 4.9477 ms/op 4.7623 ms/op 1.04
Uint64 deserialize 100000 - by byte 39.960 ms/op 40.025 ms/op 1.00

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review July 16, 2024 08:27
@twoeths twoeths requested a review from a team as a code owner July 16, 2024 08:27
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

looks amazing!! great work Tuyen! 🚀

@wemeetagain wemeetagain merged commit 1578883 into master Jul 17, 2024
8 checks passed
@wemeetagain wemeetagain deleted the tuyen/batch_hash_persistent_merkle_tree branch July 17, 2024 12:30
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.

3 participants