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: batch hash ViewDU #385

Closed
wants to merge 6 commits into from
Closed

feat: batch hash ViewDU #385

wants to merge 6 commits into from

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jul 18, 2024

Motivation

Description

  • In TreeViewDU.hashTreeRoot(), during commit() phase also compute HashComputations using setNodesAtDepth() in the previous PR feat: implement batch hash utils #384, then finally call executeHashComputations() in the previous PR feat: implement batch hash utils #384
    • add optional parameter hashComps?: HashComputationGroup | null to ViewDU.commit() method. If calling from hashTreeRoot(), pass a HashComputationGroup there, else null
  • Right now lodestar validator is modeled as a ContainerNodeStructViewDU that make it impossible to compute HashComputations there because it's not tree backed. So I came up a solution to also compute validator roots in batch in ListValidatorTreeViewDU.commit()
    • one key improvement is not to create validator tree (which takes a lot of memory) when computing its root
    • computing (ContainerNodeStruct) validators in commit() seems a bit abnormal but:
      • it does not break the current design: we still can change data multiple times before the commit(), we can also do multiple commit() calls
      • we always have to do hashTreeRoot() per state transition
  • benchmark in packages/ssz/test/perf/eth2/beaconState.test.ts showed ~7x improvement in my Mac M1 compared to the previous release

Implementation Notes for lodestar

  • need to sync ListValidatorTreeViewDU and ListValidatorType and define validators as this new type there

Note for reviewers

  • start from packages/ssz/src/viewDU/abstract.ts, hashTreeRoot() method
  • review packages/ssz/test/lodestarTypes/phase0/viewDU/listValidator.ts on the way to hash multiple validators in batch using single memory allocation

@github-actions github-actions bot added the ssz label Jul 18, 2024
@twoeths twoeths changed the title feat: batch hash viewdu feat!: batch hash viewdu Jul 18, 2024
Copy link

github-actions bot commented Jul 18, 2024

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: fedf0a8 Previous: 1578883 Ratio
hashTreeRoot - ContainerType 239.00 ns/op 720.00 ns/op 0.33
hashTreeRoot - ContainerNodeStructType 230.00 ns/op 759.00 ns/op 0.30
List(Validator-NS) 100000 struct -> binary 7.0140 ms/op 26.850 ms/op 0.26
Full benchmark results
Benchmark suite Current: fedf0a8 Previous: 1578883 Ratio
digestTwoHashObjects 50023 times 47.846 ms/op 48.098 ms/op 0.99
digest64 50023 times 49.931 ms/op 51.043 ms/op 0.98
digest 50023 times 51.903 ms/op 58.931 ms/op 0.88
input length 32 1.1990 us/op 1.4760 us/op 0.81
input length 64 1.3520 us/op 1.6290 us/op 0.83
input length 128 2.2740 us/op 2.6700 us/op 0.85
input length 256 3.3690 us/op 3.8610 us/op 0.87
input length 512 5.5580 us/op 6.2890 us/op 0.88
input length 1024 10.724 us/op 11.592 us/op 0.93
digest 1000000 times 833.39 ms/op 894.07 ms/op 0.93
hashObjectToByteArray 50023 times 1.4329 ms/op 1.4538 ms/op 0.99
byteArrayToHashObject 50023 times 2.7037 ms/op 2.8036 ms/op 0.96
digest64 200092 times 207.41 ms/op 237.79 ms/op 0.87
hash 200092 times using batchHash4UintArray64s 215.44 ms/op 242.40 ms/op 0.89
digest64HashObjects 200092 times 194.98 ms/op 208.10 ms/op 0.94
hash 200092 times using batchHash4HashObjectInputs 211.01 ms/op 223.96 ms/op 0.94
getGindicesAtDepth 4.5100 us/op 4.6070 us/op 0.98
iterateAtDepth 8.2370 us/op 8.5470 us/op 0.96
getGindexBits 495.00 ns/op 543.00 ns/op 0.91
gindexIterator 1.1350 us/op 1.1530 us/op 0.98
hash 2 Uint8Array 500000 times - as-sha256 525.46 ms/op 589.77 ms/op 0.89
hashTwoObjects 500000 times - as-sha256 498.17 ms/op 502.44 ms/op 0.99
executeHashComputations - as-sha256 47.450 ms/op 46.575 ms/op 1.02
hash 2 Uint8Array 500000 times - noble 1.0721 s/op 1.1988 s/op 0.89
hashTwoObjects 500000 times - noble 1.5197 s/op 1.7515 s/op 0.87
executeHashComputations - noble 40.391 ms/op 38.344 ms/op 1.05
hash 2 Uint8Array 500000 times - hashtree 231.60 ms/op 234.30 ms/op 0.99
hashTwoObjects 500000 times - hashtree 217.04 ms/op 219.16 ms/op 0.99
executeHashComputations - hashtree 16.346 ms/op 16.988 ms/op 0.96
getNodeH() x7812.5 avg hindex 12.043 us/op 13.049 us/op 0.92
getNodeH() x7812.5 index 0 6.2270 us/op 6.2460 us/op 1.00
getNodeH() x7812.5 index 7 6.2250 us/op 6.2530 us/op 1.00
getNodeH() x7812.5 index 7 with key array 6.2420 us/op 6.2390 us/op 1.00
new LeafNode() x7812.5 14.665 us/op 14.671 us/op 1.00
getHashComputations 250000 nodes 21.116 ms/op 18.731 ms/op 1.13
batchHash 250000 nodes 333.69 ms/op 351.19 ms/op 0.95
get root 250000 nodes 792.42 ms/op 969.79 ms/op 0.82
getHashComputations 500000 nodes 38.475 ms/op 36.103 ms/op 1.07
batchHash 500000 nodes 564.74 ms/op 621.06 ms/op 0.91
get root 500000 nodes 1.5627 s/op 1.9052 s/op 0.82
getHashComputations 1000000 nodes 87.595 ms/op 85.949 ms/op 1.02
batchHash 1000000 nodes 1.1604 s/op 1.2345 s/op 0.94
get root 1000000 nodes 3.1352 s/op 3.8316 s/op 0.82
multiproof - depth 15, 1 requested leaves 7.9180 us/op 9.6840 us/op 0.82
tree offset multiproof - depth 15, 1 requested leaves 17.811 us/op 20.935 us/op 0.85
compact multiproof - depth 15, 1 requested leaves 3.3360 us/op 4.4030 us/op 0.76
multiproof - depth 15, 2 requested leaves 11.616 us/op 14.202 us/op 0.82
tree offset multiproof - depth 15, 2 requested leaves 21.382 us/op 24.979 us/op 0.86
compact multiproof - depth 15, 2 requested leaves 3.3980 us/op 4.4450 us/op 0.76
multiproof - depth 15, 3 requested leaves 16.297 us/op 19.463 us/op 0.84
tree offset multiproof - depth 15, 3 requested leaves 27.347 us/op 32.084 us/op 0.85
compact multiproof - depth 15, 3 requested leaves 3.9260 us/op 5.9560 us/op 0.66
multiproof - depth 15, 4 requested leaves 21.272 us/op 25.203 us/op 0.84
tree offset multiproof - depth 15, 4 requested leaves 33.628 us/op 39.971 us/op 0.84
compact multiproof - depth 15, 4 requested leaves 4.5870 us/op 7.0430 us/op 0.65
packedRootsBytesToLeafNodes bytes 4000 offset 0 1.7420 us/op 3.4100 us/op 0.51
packedRootsBytesToLeafNodes bytes 4000 offset 1 1.7350 us/op 2.8950 us/op 0.60
packedRootsBytesToLeafNodes bytes 4000 offset 2 1.7350 us/op 2.6660 us/op 0.65
packedRootsBytesToLeafNodes bytes 4000 offset 3 1.7550 us/op 2.4340 us/op 0.72
subtreeFillToContents depth 40 count 250000 42.571 ms/op 45.302 ms/op 0.94
setRoot - gindexBitstring 9.7740 ms/op 11.446 ms/op 0.85
setRoot - gindex 10.541 ms/op 12.246 ms/op 0.86
getRoot - gindexBitstring 2.5029 ms/op 2.7112 ms/op 0.92
getRoot - gindex 3.3715 ms/op 3.6256 ms/op 0.93
getHashObject then setHashObject 11.344 ms/op 12.206 ms/op 0.93
setNodeWithFn 9.1813 ms/op 9.6518 ms/op 0.95
getNodeAtDepth depth 0 x100000 1.1136 ms/op 1.1147 ms/op 1.00
setNodeAtDepth depth 0 x100000 2.7672 ms/op 2.9412 ms/op 0.94
getNodesAtDepth depth 0 x100000 1.0529 ms/op 1.0527 ms/op 1.00
setNodesAtDepth depth 0 x100000 1.4550 ms/op 1.4598 ms/op 1.00
getNodeAtDepth depth 1 x100000 1.1959 ms/op 1.1820 ms/op 1.01
setNodeAtDepth depth 1 x100000 5.8294 ms/op 6.3041 ms/op 0.92
getNodesAtDepth depth 1 x100000 1.1797 ms/op 1.1771 ms/op 1.00
setNodesAtDepth depth 1 x100000 4.7047 ms/op 5.2765 ms/op 0.89
getNodeAtDepth depth 2 x100000 1.4545 ms/op 1.4545 ms/op 1.00
setNodeAtDepth depth 2 x100000 10.001 ms/op 11.988 ms/op 0.83
getNodesAtDepth depth 2 x100000 19.915 ms/op 20.101 ms/op 0.99
setNodesAtDepth depth 2 x100000 13.995 ms/op 14.807 ms/op 0.95
tree.getNodesAtDepth - gindexes 7.8210 ms/op 9.9621 ms/op 0.79
tree.getNodesAtDepth - push all nodes 2.2461 ms/op 2.1940 ms/op 1.02
tree.getNodesAtDepth - navigation 232.30 us/op 232.52 us/op 1.00
tree.setNodesAtDepth - indexes 425.67 us/op 487.95 us/op 0.87
set at depth 8 487.00 ns/op 588.00 ns/op 0.83
set at depth 16 652.00 ns/op 807.00 ns/op 0.81
set at depth 32 1.0530 us/op 1.2130 us/op 0.87
iterateNodesAtDepth 8 256 13.520 us/op 14.946 us/op 0.90
getNodesAtDepth 8 256 3.4970 us/op 3.7070 us/op 0.94
iterateNodesAtDepth 16 65536 4.3896 ms/op 4.5803 ms/op 0.96
getNodesAtDepth 16 65536 1.9909 ms/op 1.7377 ms/op 1.15
iterateNodesAtDepth 32 250000 15.644 ms/op 16.474 ms/op 0.95
getNodesAtDepth 32 250000 4.6738 ms/op 5.0082 ms/op 0.93
iterateNodesAtDepth 40 250000 15.860 ms/op 16.404 ms/op 0.97
getNodesAtDepth 40 250000 4.7857 ms/op 5.1320 ms/op 0.93
1600000 validators root getter 5.9532 s/op 6.5100 s/op 0.91
1600000 validators batchHash() 1.8078 s/op 1.9170 s/op 0.94
1600000 validators hashComputations 135.95 ms/op 144.23 ms/op 0.94
bitlist bytes to struct (120,90) 477.00 ns/op 586.00 ns/op 0.81
bitlist bytes to tree (120,90) 1.9700 us/op 2.7340 us/op 0.72
bitlist bytes to struct (2048,2048) 854.00 ns/op 1.2650 us/op 0.68
bitlist bytes to tree (2048,2048) 3.0660 us/op 4.3770 us/op 0.70
ByteListType - deserialize 8.6075 ms/op 10.544 ms/op 0.82
BasicListType - deserialize 10.251 ms/op 14.148 ms/op 0.72
ByteListType - serialize 8.4343 ms/op 10.549 ms/op 0.80
BasicListType - serialize 10.809 ms/op 14.591 ms/op 0.74
BasicListType - tree_convertToStruct 17.434 ms/op 27.925 ms/op 0.62
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.3715 ms/op 6.6210 ms/op 0.66
List[uint8, 68719476736] len 300000 ViewDU.get(i) 3.9783 ms/op 3.9754 ms/op 1.00
Array.push len 300000 empty Array - number 6.0136 ms/op 7.9548 ms/op 0.76
Array.set len 300000 from new Array - number 1.8401 ms/op 2.8766 ms/op 0.64
Array.set len 300000 - number 5.6473 ms/op 7.3264 ms/op 0.77
Uint8Array.set len 300000 377.22 us/op 393.20 us/op 0.96
Uint32Array.set len 300000 439.58 us/op 479.10 us/op 0.92
Container({a: uint8, b: uint8}) getViewDU x300000 49.870 ms/op 57.757 ms/op 0.86
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 10.744 ms/op 11.975 ms/op 0.90
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 205.27 ms/op 222.54 ms/op 0.92
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 237.30 ms/op 281.44 ms/op 0.84
List(Container) len 300000 ViewDU.get(i) 6.3166 ms/op 10.823 ms/op 0.58
List(Container) len 300000 ViewDU.getReadonly(i) 6.3771 ms/op 9.5995 ms/op 0.66
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 38.476 ms/op 40.461 ms/op 0.95
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 4.7223 ms/op 6.7733 ms/op 0.70
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 5.9830 ms/op 10.390 ms/op 0.58
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 5.8540 ms/op 9.7459 ms/op 0.60
Array.push len 300000 empty Array - object 5.8278 ms/op 7.2653 ms/op 0.80
Array.set len 300000 from new Array - object 2.0905 ms/op 3.4506 ms/op 0.61
Array.set len 300000 - object 5.6740 ms/op 7.1740 ms/op 0.79
cachePermanentRootStruct no cache 5.3080 us/op 9.9890 us/op 0.53
cachePermanentRootStruct with cache 227.00 ns/op 283.00 ns/op 0.80
epochParticipation len 250000 rws 7813 2.2264 ms/op 2.4283 ms/op 0.92
BeaconState ViewDU recursive hash vc=200000 216.78 ms/op
BeaconState ViewDU recursive hash - commit step vc=200000 160.29 ms/op
BeaconState ViewDU validator tree creation vc=100000 220.07 ms/op
BeaconState ViewDU batchHash vc=200000 213.37 ms/op
BeaconState ViewDU batchHash - commit & getHashComputation vc=200000 174.17 ms/op
BeaconState ViewDU batchHash - hash step vc=200000 35.648 ms/op
BeaconState ViewDU hashTreeRoot vc=200000 204.01 ms/op
BeaconState ViewDU hashTreeRoot - commit step vc=200000 167.48 ms/op
BeaconState ViewDU hashTreeRoot - hash step vc=200000 43.223 ms/op
deserialize Attestation - tree 3.9110 us/op 4.7050 us/op 0.83
deserialize Attestation - struct 1.7420 us/op 2.2840 us/op 0.76
deserialize SignedAggregateAndProof - tree 3.6640 us/op 4.8490 us/op 0.76
deserialize SignedAggregateAndProof - struct 2.9170 us/op 4.0770 us/op 0.72
deserialize SyncCommitteeMessage - tree 1.0580 us/op 1.2650 us/op 0.84
deserialize SyncCommitteeMessage - struct 1.0460 us/op 1.1920 us/op 0.88
deserialize SignedContributionAndProof - tree 2.0700 us/op 2.4780 us/op 0.84
deserialize SignedContributionAndProof - struct 2.2070 us/op 2.5910 us/op 0.85
deserialize SignedBeaconBlock - tree 205.90 us/op 245.64 us/op 0.84
deserialize SignedBeaconBlock - struct 117.86 us/op 130.47 us/op 0.90
BeaconState vc 300000 - deserialize tree 509.55 ms/op 606.77 ms/op 0.84
BeaconState vc 300000 - serialize tree 103.34 ms/op 140.97 ms/op 0.73
BeaconState.historicalRoots vc 300000 - deserialize tree 849.00 ns/op 870.00 ns/op 0.98
BeaconState.historicalRoots vc 300000 - serialize tree 615.00 ns/op 744.00 ns/op 0.83
BeaconState.validators vc 300000 - deserialize tree 502.48 ms/op 561.01 ms/op 0.90
BeaconState.validators vc 300000 - serialize tree 43.113 ms/op 99.779 ms/op 0.43
BeaconState.balances vc 300000 - deserialize tree 14.966 ms/op 21.893 ms/op 0.68
BeaconState.balances vc 300000 - serialize tree 3.3908 ms/op 7.1918 ms/op 0.47
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 394.80 us/op 792.47 us/op 0.50
BeaconState.previousEpochParticipation vc 300000 - serialize tree 290.78 us/op 300.54 us/op 0.97
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 386.95 us/op 827.63 us/op 0.47
BeaconState.currentEpochParticipation vc 300000 - serialize tree 286.33 us/op 304.86 us/op 0.94
BeaconState.inactivityScores vc 300000 - deserialize tree 20.997 ms/op 22.522 ms/op 0.93
BeaconState.inactivityScores vc 300000 - serialize tree 3.3480 ms/op 7.3602 ms/op 0.45
hashTreeRoot Attestation - struct 23.788 us/op 62.645 us/op 0.38
hashTreeRoot Attestation - tree 9.4210 us/op 23.452 us/op 0.40
hashTreeRoot SignedAggregateAndProof - struct 27.943 us/op 70.788 us/op 0.39
hashTreeRoot SignedAggregateAndProof - tree 13.077 us/op 30.654 us/op 0.43
hashTreeRoot SyncCommitteeMessage - struct 7.0540 us/op 18.128 us/op 0.39
hashTreeRoot SyncCommitteeMessage - tree 3.1580 us/op 7.2220 us/op 0.44
hashTreeRoot SignedContributionAndProof - struct 16.229 us/op 38.246 us/op 0.42
hashTreeRoot SignedContributionAndProof - tree 8.8870 us/op 20.813 us/op 0.43
hashTreeRoot SignedBeaconBlock - struct 1.3762 ms/op 2.9015 ms/op 0.47
hashTreeRoot SignedBeaconBlock - tree 816.19 us/op 1.8997 ms/op 0.43
hashTreeRoot Validator - struct 7.8670 us/op 15.298 us/op 0.51
hashTreeRoot Validator - tree 6.2980 us/op 13.129 us/op 0.48
BeaconState vc 300000 - hashTreeRoot tree 3.0594 s/op 4.0034 s/op 0.76
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.7420 us/op 1.6540 us/op 1.05
BeaconState.validators vc 300000 - hashTreeRoot tree 1.9037 s/op 3.8062 s/op 0.50
BeaconState.balances vc 300000 - hashTreeRoot tree 31.760 ms/op 83.211 ms/op 0.38
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 3.3842 ms/op 10.045 ms/op 0.34
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 3.4700 ms/op 10.030 ms/op 0.35
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 32.346 ms/op 81.030 ms/op 0.40
hash64 x18 9.0990 us/op 19.871 us/op 0.46
hashTwoObjects x18 8.3740 us/op 20.332 us/op 0.41
hash64 x1740 844.33 us/op 1.8450 ms/op 0.46
hashTwoObjects x1740 780.65 us/op 1.8995 ms/op 0.41
hash64 x2700000 1.3020 s/op 2.8693 s/op 0.45
hashTwoObjects x2700000 1.2224 s/op 2.9436 s/op 0.42
get_exitEpoch - ContainerType 194.00 ns/op 459.00 ns/op 0.42
get_exitEpoch - ContainerNodeStructType 208.00 ns/op 425.00 ns/op 0.49
set_exitEpoch - ContainerType 229.00 ns/op 461.00 ns/op 0.50
set_exitEpoch - ContainerNodeStructType 212.00 ns/op 446.00 ns/op 0.48
get_pubkey - ContainerType 817.00 ns/op 884.00 ns/op 0.92
get_pubkey - ContainerNodeStructType 196.00 ns/op 439.00 ns/op 0.45
hashTreeRoot - ContainerType 239.00 ns/op 720.00 ns/op 0.33
hashTreeRoot - ContainerNodeStructType 230.00 ns/op 759.00 ns/op 0.30
createProof - ContainerType 3.7510 us/op 5.6070 us/op 0.67
createProof - ContainerNodeStructType 19.186 us/op 27.166 us/op 0.71
serialize - ContainerType 1.6200 us/op 2.1220 us/op 0.76
serialize - ContainerNodeStructType 1.0530 us/op 1.7310 us/op 0.61
set_exitEpoch_and_hashTreeRoot - ContainerType 5.5400 us/op 5.5210 us/op 1.00
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 6.6400 us/op 13.800 us/op 0.48
Array - for of 5.6120 us/op 5.8690 us/op 0.96
Array - for(;;) 5.5080 us/op 5.8750 us/op 0.94
basicListValue.readonlyValuesArray() 4.0911 ms/op 4.9419 ms/op 0.83
basicListValue.readonlyValuesArray() + loop all 4.2070 ms/op 5.1149 ms/op 0.82
compositeListValue.readonlyValuesArray() 28.836 ms/op 29.257 ms/op 0.99
compositeListValue.readonlyValuesArray() + loop all 27.938 ms/op 28.781 ms/op 0.97
Number64UintType - get balances list 4.3277 ms/op 4.6154 ms/op 0.94
Number64UintType - set balances list 9.5760 ms/op 9.7880 ms/op 0.98
Number64UintType - get and increase 10 then set 38.357 ms/op 38.538 ms/op 1.00
Number64UintType - increase 10 using applyDelta 15.783 ms/op 16.731 ms/op 0.94
Number64UintType - increase 10 using applyDeltaInBatch 15.749 ms/op 16.269 ms/op 0.97
tree_newTreeFromUint64Deltas 16.302 ms/op 17.213 ms/op 0.95
unsafeUint8ArrayToTree 29.796 ms/op 31.231 ms/op 0.95
bitLength(50) 208.00 ns/op 233.00 ns/op 0.89
bitLengthStr(50) 200.00 ns/op 217.00 ns/op 0.92
bitLength(8000) 202.00 ns/op 227.00 ns/op 0.89
bitLengthStr(8000) 245.00 ns/op 267.00 ns/op 0.92
bitLength(250000) 202.00 ns/op 228.00 ns/op 0.89
bitLengthStr(250000) 279.00 ns/op 301.00 ns/op 0.93
floor - Math.floor (53) 1.2379 ns/op 1.2385 ns/op 1.00
floor - << 0 (53) 1.2375 ns/op 1.2380 ns/op 1.00
floor - Math.floor (512) 1.2589 ns/op 1.2478 ns/op 1.01
floor - << 0 (512) 1.2381 ns/op 1.2374 ns/op 1.00
fnIf(0) 1.5460 ns/op 1.5457 ns/op 1.00
fnSwitch(0) 2.1988 ns/op 2.1699 ns/op 1.01
fnObj(0) 1.5481 ns/op 1.5492 ns/op 1.00
fnArr(0) 1.5459 ns/op 1.5463 ns/op 1.00
fnIf(4) 2.1639 ns/op 2.1650 ns/op 1.00
fnSwitch(4) 2.2007 ns/op 2.1637 ns/op 1.02
fnObj(4) 1.5713 ns/op 1.5530 ns/op 1.01
fnArr(4) 1.5485 ns/op 1.5476 ns/op 1.00
fnIf(9) 3.1323 ns/op 3.0923 ns/op 1.01
fnSwitch(9) 2.1930 ns/op 2.1645 ns/op 1.01
fnObj(9) 1.5525 ns/op 1.5496 ns/op 1.00
fnArr(9) 1.5463 ns/op 1.5521 ns/op 1.00
Container {a,b,vec} - as struct x100000 124.13 us/op 124.01 us/op 1.00
Container {a,b,vec} - as tree x100000 340.68 us/op 340.82 us/op 1.00
Container {a,vec,b} - as struct x100000 154.84 us/op 155.04 us/op 1.00
Container {a,vec,b} - as tree x100000 371.27 us/op 371.57 us/op 1.00
get 2 props x1000000 - rawObject 310.95 us/op 310.24 us/op 1.00
get 2 props x1000000 - proxy 72.690 ms/op 72.781 ms/op 1.00
get 2 props x1000000 - customObj 309.39 us/op 309.17 us/op 1.00
Simple object binary -> struct 768.00 ns/op 565.00 ns/op 1.36
Simple object binary -> tree_backed 1.5800 us/op 1.0470 us/op 1.51
Simple object struct -> tree_backed 2.2210 us/op 1.6310 us/op 1.36
Simple object tree_backed -> struct 1.8530 us/op 1.5940 us/op 1.16
Simple object struct -> binary 910.00 ns/op 850.00 ns/op 1.07
Simple object tree_backed -> binary 1.5390 us/op 1.3320 us/op 1.16
aggregationBits binary -> struct 575.00 ns/op 470.00 ns/op 1.22
aggregationBits binary -> tree_backed 2.2960 us/op 2.0660 us/op 1.11
aggregationBits struct -> tree_backed 2.7070 us/op 2.4270 us/op 1.12
aggregationBits tree_backed -> struct 1.1710 us/op 1.0350 us/op 1.13
aggregationBits struct -> binary 758.00 ns/op 747.00 ns/op 1.01
aggregationBits tree_backed -> binary 1.0040 us/op 952.00 ns/op 1.05
List(uint8) 100000 binary -> struct 1.2582 ms/op 1.1825 ms/op 1.06
List(uint8) 100000 binary -> tree_backed 83.141 us/op 86.720 us/op 0.96
List(uint8) 100000 struct -> tree_backed 1.0877 ms/op 1.1340 ms/op 0.96
List(uint8) 100000 tree_backed -> struct 957.37 us/op 1.0001 ms/op 0.96
List(uint8) 100000 struct -> binary 994.71 us/op 987.80 us/op 1.01
List(uint8) 100000 tree_backed -> binary 89.544 us/op 90.795 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.1828 ms/op 1.2471 ms/op 0.95
List(uint64Number) 100000 binary -> tree_backed 2.8988 ms/op 3.3607 ms/op 0.86
List(uint64Number) 100000 struct -> tree_backed 3.9929 ms/op 4.7563 ms/op 0.84
List(uint64Number) 100000 tree_backed -> struct 2.0670 ms/op 2.2367 ms/op 0.92
List(uint64Number) 100000 struct -> binary 1.3377 ms/op 1.5556 ms/op 0.86
List(uint64Number) 100000 tree_backed -> binary 847.78 us/op 869.93 us/op 0.97
List(Uint64Bigint) 100000 binary -> struct 3.6011 ms/op 3.5944 ms/op 1.00
List(Uint64Bigint) 100000 binary -> tree_backed 2.7021 ms/op 3.3181 ms/op 0.81
List(Uint64Bigint) 100000 struct -> tree_backed 4.3377 ms/op 5.4001 ms/op 0.80
List(Uint64Bigint) 100000 tree_backed -> struct 4.1024 ms/op 4.8992 ms/op 0.84
List(Uint64Bigint) 100000 struct -> binary 2.0159 ms/op 2.0607 ms/op 0.98
List(Uint64Bigint) 100000 tree_backed -> binary 856.29 us/op 1.3819 ms/op 0.62
Vector(Root) 100000 binary -> struct 26.065 ms/op 30.789 ms/op 0.85
Vector(Root) 100000 binary -> tree_backed 31.672 ms/op 32.594 ms/op 0.97
Vector(Root) 100000 struct -> tree_backed 38.468 ms/op 35.251 ms/op 1.09
Vector(Root) 100000 tree_backed -> struct 43.882 ms/op 43.491 ms/op 1.01
Vector(Root) 100000 struct -> binary 2.8728 ms/op 2.6369 ms/op 1.09
Vector(Root) 100000 tree_backed -> binary 8.9224 ms/op 10.085 ms/op 0.88
List(Validator) 100000 binary -> struct 98.380 ms/op 94.057 ms/op 1.05
List(Validator) 100000 binary -> tree_backed 258.27 ms/op 291.23 ms/op 0.89
List(Validator) 100000 struct -> tree_backed 290.59 ms/op 302.31 ms/op 0.96
List(Validator) 100000 tree_backed -> struct 188.80 ms/op 197.29 ms/op 0.96
List(Validator) 100000 struct -> binary 28.928 ms/op 26.666 ms/op 1.08
List(Validator) 100000 tree_backed -> binary 100.57 ms/op 102.67 ms/op 0.98
List(Validator-NS) 100000 binary -> struct 99.393 ms/op 105.55 ms/op 0.94
List(Validator-NS) 100000 binary -> tree_backed 128.55 ms/op 144.09 ms/op 0.89
List(Validator-NS) 100000 struct -> tree_backed 148.52 ms/op 172.04 ms/op 0.86
List(Validator-NS) 100000 tree_backed -> struct 129.21 ms/op 149.45 ms/op 0.86
List(Validator-NS) 100000 struct -> binary 7.0140 ms/op 26.850 ms/op 0.26
List(Validator-NS) 100000 tree_backed -> binary 12.398 ms/op 31.772 ms/op 0.39
get epochStatuses - MutableVector 105.33 us/op 91.125 us/op 1.16
get epochStatuses - ViewDU 207.40 us/op 203.25 us/op 1.02
set epochStatuses - ListTreeView 2.6593 ms/op 1.4927 ms/op 1.78
set epochStatuses - ListTreeView - set() 433.51 us/op 432.51 us/op 1.00
set epochStatuses - ListTreeView - commit() 1.2406 ms/op 520.98 us/op 2.38
bitstring 638.76 ns/op 636.31 ns/op 1.00
bit mask 14.591 ns/op 13.900 ns/op 1.05
struct - increase slot to 1000000 927.90 us/op 928.09 us/op 1.00
UintNumberType - increase slot to 1000000 21.682 ms/op 23.525 ms/op 0.92
UintBigintType - increase slot to 1000000 161.51 ms/op 155.34 ms/op 1.04
UintBigint8 x 100000 tree_deserialize 4.5828 ms/op 4.7437 ms/op 0.97
UintBigint8 x 100000 tree_serialize 1.1069 ms/op 1.1149 ms/op 0.99
UintBigint16 x 100000 tree_deserialize 4.2456 ms/op 4.8136 ms/op 0.88
UintBigint16 x 100000 tree_serialize 1.1595 ms/op 1.1636 ms/op 1.00
UintBigint32 x 100000 tree_deserialize 4.6179 ms/op 5.0074 ms/op 0.92
UintBigint32 x 100000 tree_serialize 1.1725 ms/op 1.1815 ms/op 0.99
UintBigint64 x 100000 tree_deserialize 5.3365 ms/op 5.2460 ms/op 1.02
UintBigint64 x 100000 tree_serialize 1.5336 ms/op 1.5897 ms/op 0.96
UintBigint8 x 100000 value_deserialize 437.94 us/op 433.00 us/op 1.01
UintBigint8 x 100000 value_serialize 606.92 us/op 595.68 us/op 1.02
UintBigint16 x 100000 value_deserialize 465.70 us/op 468.20 us/op 0.99
UintBigint16 x 100000 value_serialize 674.80 us/op 661.48 us/op 1.02
UintBigint32 x 100000 value_deserialize 433.40 us/op 433.32 us/op 1.00
UintBigint32 x 100000 value_serialize 644.13 us/op 630.69 us/op 1.02
UintBigint64 x 100000 value_deserialize 523.88 us/op 498.13 us/op 1.05
UintBigint64 x 100000 value_serialize 822.01 us/op 833.07 us/op 0.99
UintBigint8 x 100000 deserialize 2.9269 ms/op 3.0272 ms/op 0.97
UintBigint8 x 100000 serialize 1.6378 ms/op 1.4133 ms/op 1.16
UintBigint16 x 100000 deserialize 2.8822 ms/op 3.1150 ms/op 0.93
UintBigint16 x 100000 serialize 1.4388 ms/op 1.4402 ms/op 1.00
UintBigint32 x 100000 deserialize 2.9158 ms/op 3.2150 ms/op 0.91
UintBigint32 x 100000 serialize 2.6678 ms/op 2.7030 ms/op 0.99
UintBigint64 x 100000 deserialize 3.8168 ms/op 3.6790 ms/op 1.04
UintBigint64 x 100000 serialize 1.4873 ms/op 1.5052 ms/op 0.99
UintBigint128 x 100000 deserialize 4.9182 ms/op 5.2996 ms/op 0.93
UintBigint128 x 100000 serialize 14.457 ms/op 15.174 ms/op 0.95
UintBigint256 x 100000 deserialize 7.6660 ms/op 8.0697 ms/op 0.95
UintBigint256 x 100000 serialize 43.633 ms/op 45.420 ms/op 0.96
Slice from Uint8Array x25000 1.1185 ms/op 1.1276 ms/op 0.99
Slice from ArrayBuffer x25000 14.851 ms/op 16.514 ms/op 0.90
Slice from ArrayBuffer x25000 + new Uint8Array 14.122 ms/op 17.645 ms/op 0.80
Copy Uint8Array 100000 iterate 1.6395 ms/op 1.8561 ms/op 0.88
Copy Uint8Array 100000 slice 96.792 us/op 177.74 us/op 0.54
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 97.836 us/op 164.50 us/op 0.59
Copy Buffer 100000 Uint8Array.prototype.slice.call 97.002 us/op 173.89 us/op 0.56
Copy Uint8Array 100000 slice + set 148.72 us/op 315.78 us/op 0.47
Copy Uint8Array 100000 subarray + set 97.679 us/op 168.51 us/op 0.58
Copy Uint8Array 100000 slice arrayBuffer 97.285 us/op 175.35 us/op 0.55
Uint64 deserialize 100000 - iterate Uint8Array 1.6703 ms/op 1.8257 ms/op 0.91
Uint64 deserialize 100000 - by Uint32A 1.7140 ms/op 1.7573 ms/op 0.98
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.7273 ms/op 1.7824 ms/op 0.97
Uint64 deserialize 100000 - by DataView.getBigUint64 4.7278 ms/op 4.9919 ms/op 0.95
Uint64 deserialize 100000 - by byte 39.941 ms/op 39.996 ms/op 1.00

by benchmarkbot/action

@twoeths twoeths changed the title feat!: batch hash viewdu feat: batch hash viewdu Jul 18, 2024
@twoeths twoeths changed the title feat: batch hash viewdu feat: batch hash ViewDU Jul 18, 2024
@twoeths twoeths marked this pull request as ready for review July 18, 2024 07:43
@twoeths twoeths requested a review from a team as a code owner July 18, 2024 07:43
@twoeths
Copy link
Contributor Author

twoeths commented Jul 23, 2024

due to #386 a lot of apis are refactored so closing this PR for now

@twoeths twoeths closed this Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant