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 sliceTo() for ListBasicTreeViewDU #336

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Sep 18, 2023

Motivation

  • For lodestar, we may want to load beacon state ssz bytes to an existing ViewDU object, this is needed to optimize the process in case a field is rarely changed

Description

@twoeths twoeths requested a review from a team as a code owner September 18, 2023 09:13
@github-actions github-actions bot added the ssz label Sep 18, 2023
@github-actions
Copy link

github-actions bot commented Sep 18, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 09e9a37 Previous: d18ea08 Ratio
digestTwoHashObjects 50023 times 58.090 ms/op 68.926 ms/op 0.84
digest64 50023 times 60.734 ms/op 71.043 ms/op 0.85
digest 50023 times 60.560 ms/op 70.707 ms/op 0.86
input length 32 1.4550 us/op 1.6110 us/op 0.90
input length 64 1.5890 us/op 1.8130 us/op 0.88
input length 128 2.7610 us/op 3.1400 us/op 0.88
input length 256 4.1150 us/op 4.7730 us/op 0.86
input length 512 6.7480 us/op 7.9680 us/op 0.85
input length 1024 13.479 us/op 15.606 us/op 0.86
digest 1000000 times 1.0461 s/op 1.1489 s/op 0.91
hashObjectToByteArray 50023 times 2.7964 ms/op 1.9087 ms/op 1.47
byteArrayToHashObject 50023 times 2.7632 ms/op 2.2099 ms/op 1.25
getGindicesAtDepth 6.0970 us/op 5.6150 us/op 1.09
iterateAtDepth 12.424 us/op 11.936 us/op 1.04
getGindexBits 554.00 ns/op 588.00 ns/op 0.94
gindexIterator 1.1760 us/op 1.4490 us/op 0.81
hash 2 Uint8Array 2250026 times - as-sha256 2.7712 s/op 3.2161 s/op 0.86
hashTwoObjects 2250026 times - as-sha256 2.6380 s/op 3.1080 s/op 0.85
hash 2 Uint8Array 2250026 times - noble 7.6261 s/op 8.9766 s/op 0.85
hashTwoObjects 2250026 times - noble 11.736 s/op 11.354 s/op 1.03
getNodeH() x7812.5 avg hindex 25.693 us/op 20.736 us/op 1.24
getNodeH() x7812.5 index 0 10.961 us/op 6.8030 us/op 1.61
getNodeH() x7812.5 index 7 10.888 us/op 6.7810 us/op 1.61
getNodeH() x7812.5 index 7 with key array 10.967 us/op 6.7950 us/op 1.61
new LeafNode() x7812.5 200.30 us/op 308.94 us/op 0.65
multiproof - depth 15, 1 requested leaves 13.660 us/op 15.084 us/op 0.91
tree offset multiproof - depth 15, 1 requested leaves 29.502 us/op 32.927 us/op 0.90
compact multiproof - depth 15, 1 requested leaves 8.4070 us/op 8.2680 us/op 1.02
multiproof - depth 15, 2 requested leaves 19.986 us/op 19.442 us/op 1.03
tree offset multiproof - depth 15, 2 requested leaves 35.066 us/op 34.214 us/op 1.02
compact multiproof - depth 15, 2 requested leaves 4.9110 us/op 4.6660 us/op 1.05
multiproof - depth 15, 3 requested leaves 27.635 us/op 26.550 us/op 1.04
tree offset multiproof - depth 15, 3 requested leaves 46.534 us/op 45.947 us/op 1.01
compact multiproof - depth 15, 3 requested leaves 8.3880 us/op 8.2120 us/op 1.02
multiproof - depth 15, 4 requested leaves 34.951 us/op 34.488 us/op 1.01
tree offset multiproof - depth 15, 4 requested leaves 64.371 us/op 60.557 us/op 1.06
compact multiproof - depth 15, 4 requested leaves 8.1490 us/op 9.0510 us/op 0.90
packedRootsBytesToLeafNodes bytes 4000 offset 0 3.4740 us/op 3.0610 us/op 1.13
packedRootsBytesToLeafNodes bytes 4000 offset 1 3.4970 us/op 2.9550 us/op 1.18
packedRootsBytesToLeafNodes bytes 4000 offset 2 3.5010 us/op 2.9170 us/op 1.20
packedRootsBytesToLeafNodes bytes 4000 offset 3 3.4940 us/op 2.9210 us/op 1.20
subtreeFillToContents depth 40 count 250000 91.127 ms/op 66.498 ms/op 1.37
setRoot - gindexBitstring 14.972 ms/op 14.606 ms/op 1.03
setRoot - gindex 15.017 ms/op 16.625 ms/op 0.90
getRoot - gindexBitstring 4.0346 ms/op 3.2599 ms/op 1.24
getRoot - gindex 4.4440 ms/op 4.7667 ms/op 0.93
getHashObject then setHashObject 18.449 ms/op 20.107 ms/op 0.92
setNodeWithFn 14.415 ms/op 16.659 ms/op 0.87
getNodeAtDepth depth 0 x100000 2.4262 ms/op 1.6207 ms/op 1.50
setNodeAtDepth depth 0 x100000 4.6884 ms/op 4.2321 ms/op 1.11
getNodesAtDepth depth 0 x100000 2.0907 ms/op 1.4307 ms/op 1.46
setNodesAtDepth depth 0 x100000 2.7696 ms/op 1.9692 ms/op 1.41
getNodeAtDepth depth 1 x100000 2.6240 ms/op 1.7443 ms/op 1.50
setNodeAtDepth depth 1 x100000 11.578 ms/op 9.0717 ms/op 1.28
getNodesAtDepth depth 1 x100000 2.3649 ms/op 1.6296 ms/op 1.45
setNodesAtDepth depth 1 x100000 8.5215 ms/op 8.1125 ms/op 1.05
getNodeAtDepth depth 2 x100000 3.1695 ms/op 2.1997 ms/op 1.44
setNodeAtDepth depth 2 x100000 17.433 ms/op 15.246 ms/op 1.14
getNodesAtDepth depth 2 x100000 29.913 ms/op 28.666 ms/op 1.04
setNodesAtDepth depth 2 x100000 22.053 ms/op 20.986 ms/op 1.05
tree.getNodesAtDepth - gindexes 9.5915 ms/op 9.4448 ms/op 1.02
tree.getNodesAtDepth - push all nodes 3.0249 ms/op 3.5199 ms/op 0.86
tree.getNodesAtDepth - navigation 169.29 us/op 201.37 us/op 0.84
tree.setNodesAtDepth - indexes 608.60 us/op 649.24 us/op 0.94
set at depth 8 736.00 ns/op 851.00 ns/op 0.86
set at depth 16 970.00 ns/op 1.1420 us/op 0.85
set at depth 32 1.6400 us/op 1.7980 us/op 0.91
iterateNodesAtDepth 8 256 24.111 us/op 20.409 us/op 1.18
getNodesAtDepth 8 256 6.6080 us/op 4.7920 us/op 1.38
iterateNodesAtDepth 16 65536 7.1953 ms/op 5.9730 ms/op 1.20
getNodesAtDepth 16 65536 2.8586 ms/op 3.0157 ms/op 0.95
iterateNodesAtDepth 32 250000 27.238 ms/op 23.707 ms/op 1.15
getNodesAtDepth 32 250000 8.0682 ms/op 5.8389 ms/op 1.38
iterateNodesAtDepth 40 250000 27.169 ms/op 20.702 ms/op 1.31
getNodesAtDepth 40 250000 7.8277 ms/op 5.8522 ms/op 1.34
250k validators 11.319 s/op 11.535 s/op 0.98
bitlist bytes to struct (120,90) 947.00 ns/op 746.00 ns/op 1.27
bitlist bytes to tree (120,90) 3.6010 us/op 3.6490 us/op 0.99
bitlist bytes to struct (2048,2048) 1.7620 us/op 1.7960 us/op 0.98
bitlist bytes to tree (2048,2048) 6.4370 us/op 6.9320 us/op 0.93
ByteListType - deserialize 15.723 ms/op 16.325 ms/op 0.96
BasicListType - deserialize 16.007 ms/op 11.288 ms/op 1.42
ByteListType - serialize 15.654 ms/op 17.554 ms/op 0.89
BasicListType - serialize 18.754 ms/op 17.660 ms/op 1.06
BasicListType - tree_convertToStruct 40.437 ms/op 33.205 ms/op 1.22
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.8291 ms/op 4.7475 ms/op 1.23
List[uint8, 68719476736] len 300000 ViewDU.get(i) 6.8549 ms/op 4.5221 ms/op 1.52
Array.push len 300000 empty Array - number 7.9965 ms/op 8.1092 ms/op 0.99
Array.set len 300000 from new Array - number 2.5103 ms/op 2.4631 ms/op 1.02
Array.set len 300000 - number 8.9221 ms/op 7.5078 ms/op 1.19
Uint8Array.set len 300000 249.54 us/op 247.97 us/op 1.01
Uint32Array.set len 300000 351.15 us/op 331.33 us/op 1.06
Container({a: uint8, b: uint8}) getViewDU x300000 33.519 ms/op 32.401 ms/op 1.03
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.401 ms/op 12.912 ms/op 0.96
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 406.06 ms/op 333.16 ms/op 1.22
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 473.85 ms/op 421.58 ms/op 1.12
List(Container) len 300000 ViewDU.get(i) 11.476 ms/op 9.8608 ms/op 1.16
List(Container) len 300000 ViewDU.getReadonly(i) 13.090 ms/op 9.4244 ms/op 1.39
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 58.434 ms/op 41.958 ms/op 1.39
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 8.2944 ms/op 8.0947 ms/op 1.02
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 12.048 ms/op 8.7000 ms/op 1.38
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 12.295 ms/op 8.5745 ms/op 1.43
Array.push len 300000 empty Array - object 8.6392 ms/op 7.6700 ms/op 1.13
Array.set len 300000 from new Array - object 2.9485 ms/op 2.9385 ms/op 1.00
Array.set len 300000 - object 8.5626 ms/op 8.3933 ms/op 1.02
cachePermanentRootStruct no cache 11.973 us/op 13.636 us/op 0.88
cachePermanentRootStruct with cache 281.00 ns/op 282.00 ns/op 1.00
epochParticipation len 250000 rws 7813 3.3746 ms/op 3.1819 ms/op 1.06
deserialize Attestation - tree 4.1740 us/op 4.2370 us/op 0.99
deserialize Attestation - struct 2.9430 us/op 2.9890 us/op 0.98
deserialize SignedAggregateAndProof - tree 5.6310 us/op 5.3790 us/op 1.05
deserialize SignedAggregateAndProof - struct 4.9690 us/op 4.5550 us/op 1.09
deserialize SyncCommitteeMessage - tree 1.4800 us/op 1.6300 us/op 0.91
deserialize SyncCommitteeMessage - struct 1.8130 us/op 1.8520 us/op 0.98
deserialize SignedContributionAndProof - tree 2.7620 us/op 2.8870 us/op 0.96
deserialize SignedContributionAndProof - struct 3.9090 us/op 3.9570 us/op 0.99
deserialize SignedBeaconBlock - tree 322.01 us/op 308.28 us/op 1.04
deserialize SignedBeaconBlock - struct 212.99 us/op 202.99 us/op 1.05
BeaconState vc 300000 - deserialize tree 1.0306 s/op 927.74 ms/op 1.11
BeaconState vc 300000 - serialize tree 328.57 ms/op 279.38 ms/op 1.18
BeaconState.historicalRoots vc 300000 - deserialize tree 1.1380 us/op 1.3060 us/op 0.87
BeaconState.historicalRoots vc 300000 - serialize tree 1.2670 us/op 1.3240 us/op 0.96
BeaconState.validators vc 300000 - deserialize tree 1.0210 s/op 889.97 ms/op 1.15
BeaconState.validators vc 300000 - serialize tree 289.28 ms/op 220.35 ms/op 1.31
BeaconState.balances vc 300000 - deserialize tree 39.950 ms/op 35.796 ms/op 1.12
BeaconState.balances vc 300000 - serialize tree 5.8239 ms/op 5.3943 ms/op 1.08
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 791.55 us/op 593.32 us/op 1.33
BeaconState.previousEpochParticipation vc 300000 - serialize tree 486.51 us/op 357.71 us/op 1.36
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 820.42 us/op 617.42 us/op 1.33
BeaconState.currentEpochParticipation vc 300000 - serialize tree 480.35 us/op 359.71 us/op 1.34
BeaconState.inactivityScores vc 300000 - deserialize tree 42.171 ms/op 34.592 ms/op 1.22
BeaconState.inactivityScores vc 300000 - serialize tree 5.8251 ms/op 3.9113 ms/op 1.49
hashTreeRoot Attestation - struct 44.285 us/op 40.668 us/op 1.09
hashTreeRoot Attestation - tree 27.191 us/op 26.526 us/op 1.03
hashTreeRoot SignedAggregateAndProof - struct 60.296 us/op 56.584 us/op 1.07
hashTreeRoot SignedAggregateAndProof - tree 34.671 us/op 40.187 us/op 0.86
hashTreeRoot SyncCommitteeMessage - struct 13.940 us/op 13.525 us/op 1.03
hashTreeRoot SyncCommitteeMessage - tree 7.5800 us/op 9.0910 us/op 0.83
hashTreeRoot SignedContributionAndProof - struct 38.349 us/op 38.467 us/op 1.00
hashTreeRoot SignedContributionAndProof - tree 26.027 us/op 28.394 us/op 0.92
hashTreeRoot SignedBeaconBlock - struct 3.4460 ms/op 3.3390 ms/op 1.03
hashTreeRoot SignedBeaconBlock - tree 2.0379 ms/op 2.4169 ms/op 0.84
hashTreeRoot Validator - struct 18.426 us/op 18.924 us/op 0.97
hashTreeRoot Validator - tree 14.629 us/op 15.563 us/op 0.94
BeaconState vc 300000 - hashTreeRoot tree 4.7047 s/op 5.1781 s/op 0.91
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.8130 us/op 2.0890 us/op 0.87
BeaconState.validators vc 300000 - hashTreeRoot tree 4.4313 s/op 4.9436 s/op 0.90
BeaconState.balances vc 300000 - hashTreeRoot tree 105.01 ms/op 128.44 ms/op 0.82
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 11.116 ms/op 13.158 ms/op 0.84
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 11.104 ms/op 13.153 ms/op 0.84
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 105.81 ms/op 134.17 ms/op 0.79
hash64 x18 24.650 us/op 27.765 us/op 0.89
hashTwoObjects x18 22.196 us/op 26.031 us/op 0.85
hash64 x1740 2.3283 ms/op 2.6206 ms/op 0.89
hashTwoObjects x1740 2.0966 ms/op 2.4746 ms/op 0.85
hash64 x2700000 3.6181 s/op 4.0605 s/op 0.89
hashTwoObjects x2700000 3.2531 s/op 3.8260 s/op 0.85
get_exitEpoch - ContainerType 490.00 ns/op 490.00 ns/op 1.00
get_exitEpoch - ContainerNodeStructType 320.00 ns/op 406.00 ns/op 0.79
set_exitEpoch - ContainerType 324.00 ns/op 456.00 ns/op 0.71
set_exitEpoch - ContainerNodeStructType 294.00 ns/op 337.00 ns/op 0.87
get_pubkey - ContainerType 1.5310 us/op 1.8250 us/op 0.84
get_pubkey - ContainerNodeStructType 302.00 ns/op 300.00 ns/op 1.01
hashTreeRoot - ContainerType 511.00 ns/op 513.00 ns/op 1.00
hashTreeRoot - ContainerNodeStructType 560.00 ns/op 583.00 ns/op 0.96
createProof - ContainerType 6.3630 us/op 6.9070 us/op 0.92
createProof - ContainerNodeStructType 34.247 us/op 35.097 us/op 0.98
serialize - ContainerType 2.8040 us/op 3.0820 us/op 0.91
serialize - ContainerNodeStructType 2.2100 us/op 2.5640 us/op 0.86
set_exitEpoch_and_hashTreeRoot - ContainerType 5.2790 us/op 6.1480 us/op 0.86
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 14.833 us/op 16.892 us/op 0.88
Array - for of 13.628 us/op 6.9210 us/op 1.97
Array - for(;;) 10.370 us/op 6.5120 us/op 1.59
basicListValue.readonlyValuesArray() 5.6187 ms/op 4.5718 ms/op 1.23
basicListValue.readonlyValuesArray() + loop all 5.6305 ms/op 4.6539 ms/op 1.21
compositeListValue.readonlyValuesArray() 58.047 ms/op 48.282 ms/op 1.20
compositeListValue.readonlyValuesArray() + loop all 54.755 ms/op 45.481 ms/op 1.20
Number64UintType - get balances list 6.2360 ms/op 5.5566 ms/op 1.12
Number64UintType - set balances list 16.986 ms/op 11.994 ms/op 1.42
Number64UintType - get and increase 10 then set 61.298 ms/op 56.939 ms/op 1.08
Number64UintType - increase 10 using applyDelta 26.577 ms/op 19.056 ms/op 1.39
Number64UintType - increase 10 using applyDeltaInBatch 26.320 ms/op 19.152 ms/op 1.37
tree_newTreeFromUint64Deltas 37.328 ms/op 28.045 ms/op 1.33
unsafeUint8ArrayToTree 63.878 ms/op 51.443 ms/op 1.24
bitLength(50) 315.00 ns/op 305.00 ns/op 1.03
bitLengthStr(50) 341.00 ns/op 308.00 ns/op 1.11
bitLength(8000) 283.00 ns/op 283.00 ns/op 1.00
bitLengthStr(8000) 470.00 ns/op 369.00 ns/op 1.27
bitLength(250000) 290.00 ns/op 281.00 ns/op 1.03
bitLengthStr(250000) 565.00 ns/op 425.00 ns/op 1.33
floor - Math.floor (53) 0.66975 ns/op 0.60276 ns/op 1.11
floor - << 0 (53) 0.66968 ns/op 0.60278 ns/op 1.11
floor - Math.floor (512) 0.67039 ns/op 0.60281 ns/op 1.11
floor - << 0 (512) 0.66972 ns/op 0.60267 ns/op 1.11
fnIf(0) 3.0121 ns/op 2.0090 ns/op 1.50
fnSwitch(0) 5.0220 ns/op 3.2397 ns/op 1.55
fnObj(0) 0.66959 ns/op 0.60569 ns/op 1.11
fnArr(0) 0.66988 ns/op 0.60269 ns/op 1.11
fnIf(4) 4.3731 ns/op 3.1672 ns/op 1.38
fnSwitch(4) 5.0224 ns/op 3.2591 ns/op 1.54
fnObj(4) 0.67034 ns/op 0.60281 ns/op 1.11
fnArr(4) 0.66962 ns/op 0.60305 ns/op 1.11
fnIf(9) 6.6928 ns/op 5.2295 ns/op 1.28
fnSwitch(9) 5.0210 ns/op 3.2215 ns/op 1.56
fnObj(9) 0.66974 ns/op 0.60281 ns/op 1.11
fnArr(9) 0.66983 ns/op 0.60273 ns/op 1.11
Container {a,b,vec} - as struct x100000 67.376 us/op 60.497 us/op 1.11
Container {a,b,vec} - as tree x100000 837.46 us/op 510.82 us/op 1.64
Container {a,vec,b} - as struct x100000 100.95 us/op 120.77 us/op 0.84
Container {a,vec,b} - as tree x100000 903.79 us/op 553.80 us/op 1.63
get 2 props x1000000 - rawObject 335.33 us/op 401.99 us/op 0.83
get 2 props x1000000 - proxy 145.73 ms/op 89.719 ms/op 1.62
get 2 props x1000000 - customObj 335.15 us/op 401.94 us/op 0.83
Simple object binary -> struct 784.00 ns/op 783.00 ns/op 1.00
Simple object binary -> tree_backed 2.3180 us/op 2.2830 us/op 1.02
Simple object struct -> tree_backed 3.0520 us/op 3.2720 us/op 0.93
Simple object tree_backed -> struct 2.6160 us/op 2.9820 us/op 0.88
Simple object struct -> binary 1.3350 us/op 1.5940 us/op 0.84
Simple object tree_backed -> binary 2.4190 us/op 2.5890 us/op 0.93
aggregationBits binary -> struct 645.00 ns/op 660.00 ns/op 0.98
aggregationBits binary -> tree_backed 3.1210 us/op 3.6920 us/op 0.85
aggregationBits struct -> tree_backed 3.8540 us/op 4.3650 us/op 0.88
aggregationBits tree_backed -> struct 1.6080 us/op 1.9200 us/op 0.84
aggregationBits struct -> binary 1.1740 us/op 1.3080 us/op 0.90
aggregationBits tree_backed -> binary 1.4220 us/op 1.6650 us/op 0.85
List(uint8) 100000 binary -> struct 1.8187 ms/op 1.4840 ms/op 1.23
List(uint8) 100000 binary -> tree_backed 180.08 us/op 128.00 us/op 1.41
List(uint8) 100000 struct -> tree_backed 2.3794 ms/op 1.6657 ms/op 1.43
List(uint8) 100000 tree_backed -> struct 1.6297 ms/op 1.1675 ms/op 1.40
List(uint8) 100000 struct -> binary 2.1242 ms/op 1.5315 ms/op 1.39
List(uint8) 100000 tree_backed -> binary 146.71 us/op 94.474 us/op 1.55
List(uint64Number) 100000 binary -> struct 1.8428 ms/op 1.5201 ms/op 1.21
List(uint64Number) 100000 binary -> tree_backed 8.6886 ms/op 6.5620 ms/op 1.32
List(uint64Number) 100000 struct -> tree_backed 10.625 ms/op 8.0363 ms/op 1.32
List(uint64Number) 100000 tree_backed -> struct 3.2174 ms/op 2.5301 ms/op 1.27
List(uint64Number) 100000 struct -> binary 2.5189 ms/op 1.8612 ms/op 1.35
List(uint64Number) 100000 tree_backed -> binary 1.4025 ms/op 1.1004 ms/op 1.27
List(Uint64Bigint) 100000 binary -> struct 5.3369 ms/op 5.0419 ms/op 1.06
List(Uint64Bigint) 100000 binary -> tree_backed 8.4997 ms/op 6.8101 ms/op 1.25
List(Uint64Bigint) 100000 struct -> tree_backed 11.831 ms/op 9.0835 ms/op 1.30
List(Uint64Bigint) 100000 tree_backed -> struct 6.5660 ms/op 5.2359 ms/op 1.25
List(Uint64Bigint) 100000 struct -> binary 3.3406 ms/op 2.6082 ms/op 1.28
List(Uint64Bigint) 100000 tree_backed -> binary 1.3397 ms/op 1.0815 ms/op 1.24
Vector(Root) 100000 binary -> struct 79.473 ms/op 65.663 ms/op 1.21
Vector(Root) 100000 binary -> tree_backed 76.848 ms/op 64.469 ms/op 1.19
Vector(Root) 100000 struct -> tree_backed 83.542 ms/op 69.048 ms/op 1.21
Vector(Root) 100000 tree_backed -> struct 98.178 ms/op 82.338 ms/op 1.19
Vector(Root) 100000 struct -> binary 3.5457 ms/op 2.7154 ms/op 1.31
Vector(Root) 100000 tree_backed -> binary 14.053 ms/op 12.147 ms/op 1.16
List(Validator) 100000 binary -> struct 267.97 ms/op 226.18 ms/op 1.18
List(Validator) 100000 binary -> tree_backed 701.63 ms/op 600.87 ms/op 1.17
List(Validator) 100000 struct -> tree_backed 752.25 ms/op 650.95 ms/op 1.16
List(Validator) 100000 tree_backed -> struct 380.42 ms/op 319.10 ms/op 1.19
List(Validator) 100000 struct -> binary 50.581 ms/op 40.709 ms/op 1.24
List(Validator) 100000 tree_backed -> binary 143.57 ms/op 117.44 ms/op 1.22
List(Validator-NS) 100000 binary -> struct 285.30 ms/op 238.66 ms/op 1.20
List(Validator-NS) 100000 binary -> tree_backed 388.50 ms/op 329.08 ms/op 1.18
List(Validator-NS) 100000 struct -> tree_backed 442.61 ms/op 377.33 ms/op 1.17
List(Validator-NS) 100000 tree_backed -> struct 349.84 ms/op 297.33 ms/op 1.18
List(Validator-NS) 100000 struct -> binary 51.345 ms/op 41.832 ms/op 1.23
List(Validator-NS) 100000 tree_backed -> binary 59.189 ms/op 48.710 ms/op 1.22
get epochStatuses - MutableVector 152.68 us/op 101.44 us/op 1.51
get epochStatuses - ViewDU 297.37 us/op 289.86 us/op 1.03
set epochStatuses - ListTreeView 2.6500 ms/op 1.9997 ms/op 1.33
set epochStatuses - ListTreeView - set() 635.34 us/op 621.04 us/op 1.02
set epochStatuses - ListTreeView - commit() 928.84 us/op 732.52 us/op 1.27
bitstring 779.90 ns/op 920.30 ns/op 0.85
bit mask 12.773 ns/op 14.495 ns/op 0.88
struct - increase slot to 1000000 2.1853 ms/op 1.6792 ms/op 1.30
UintNumberType - increase slot to 1000000 49.269 ms/op 36.749 ms/op 1.34
UintBigintType - increase slot to 1000000 618.21 ms/op 557.99 ms/op 1.11
UintBigint8 x 100000 tree_deserialize 7.7357 ms/op 5.8847 ms/op 1.31
UintBigint8 x 100000 tree_serialize 2.2616 ms/op 1.4503 ms/op 1.56
UintBigint16 x 100000 tree_deserialize 7.7219 ms/op 5.8883 ms/op 1.31
UintBigint16 x 100000 tree_serialize 2.1550 ms/op 1.5000 ms/op 1.44
UintBigint32 x 100000 tree_deserialize 7.7839 ms/op 6.0459 ms/op 1.29
UintBigint32 x 100000 tree_serialize 2.0391 ms/op 1.5225 ms/op 1.34
UintBigint64 x 100000 tree_deserialize 9.1137 ms/op 6.8718 ms/op 1.33
UintBigint64 x 100000 tree_serialize 2.7282 ms/op 1.9709 ms/op 1.38
UintBigint8 x 100000 value_deserialize 870.41 us/op 542.64 us/op 1.60
UintBigint8 x 100000 value_serialize 1.2843 ms/op 874.75 us/op 1.47
UintBigint16 x 100000 value_deserialize 934.12 us/op 580.50 us/op 1.61
UintBigint16 x 100000 value_serialize 1.3103 ms/op 881.80 us/op 1.49
UintBigint32 x 100000 value_deserialize 836.94 us/op 541.74 us/op 1.54
UintBigint32 x 100000 value_serialize 1.3296 ms/op 906.32 us/op 1.47
UintBigint64 x 100000 value_deserialize 949.76 us/op 608.23 us/op 1.56
UintBigint64 x 100000 value_serialize 1.6416 ms/op 1.1400 ms/op 1.44
UintBigint8 x 100000 deserialize 8.4504 ms/op 6.1966 ms/op 1.36
UintBigint8 x 100000 serialize 2.5921 ms/op 2.1083 ms/op 1.23
UintBigint16 x 100000 deserialize 6.8412 ms/op 6.9029 ms/op 0.99
UintBigint16 x 100000 serialize 2.6956 ms/op 1.9608 ms/op 1.37
UintBigint32 x 100000 deserialize 8.0725 ms/op 7.1419 ms/op 1.13
UintBigint32 x 100000 serialize 4.2835 ms/op 3.8078 ms/op 1.12
UintBigint64 x 100000 deserialize 7.1882 ms/op 5.6990 ms/op 1.26
UintBigint64 x 100000 serialize 2.6279 ms/op 1.9938 ms/op 1.32
UintBigint128 x 100000 deserialize 8.9074 ms/op 7.8739 ms/op 1.13
UintBigint128 x 100000 serialize 26.747 ms/op 21.695 ms/op 1.23
UintBigint256 x 100000 deserialize 16.505 ms/op 13.380 ms/op 1.23
UintBigint256 x 100000 serialize 82.780 ms/op 64.470 ms/op 1.28
Slice from Uint8Array x25000 1.6858 ms/op 1.3370 ms/op 1.26
Slice from ArrayBuffer x25000 27.899 ms/op 26.669 ms/op 1.05
Slice from ArrayBuffer x25000 + new Uint8Array 28.226 ms/op 29.577 ms/op 0.95
Copy Uint8Array 100000 iterate 1.7306 ms/op 1.0555 ms/op 1.64
Copy Uint8Array 100000 slice 104.00 us/op 103.74 us/op 1.00
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 104.58 us/op 103.73 us/op 1.01
Copy Buffer 100000 Uint8Array.prototype.slice.call 106.71 us/op 109.23 us/op 0.98
Copy Uint8Array 100000 slice + set 269.09 us/op 254.38 us/op 1.06
Copy Uint8Array 100000 subarray + set 105.37 us/op 99.709 us/op 1.06
Copy Uint8Array 100000 slice arrayBuffer 100.16 us/op 100.60 us/op 1.00
Uint64 deserialize 100000 - iterate Uint8Array 2.2105 ms/op 2.1818 ms/op 1.01
Uint64 deserialize 100000 - by Uint32A 1.9912 ms/op 1.9776 ms/op 1.01
Uint64 deserialize 100000 - by DataView.getUint32 x2 2.2502 ms/op 1.9547 ms/op 1.15
Uint64 deserialize 100000 - by DataView.getBigUint64 7.0690 ms/op 5.9723 ms/op 1.18
Uint64 deserialize 100000 - by byte 69.322 ms/op 72.697 ms/op 0.95

by benchmarkbot/action

g11tech
g11tech previously approved these changes Sep 18, 2023
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.

lgtm

Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

Implementation logic looks correct and good. I would only drop support for negative integers

packages/ssz/src/viewDU/listBasic.ts Outdated Show resolved Hide resolved
@twoeths twoeths merged commit e84686b into master Sep 20, 2023
7 checks passed
@twoeths twoeths deleted the tuyen/list_basic_sliceTo branch September 20, 2023 01:34
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.

3 participants