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

fix: return correct property gindex for ContainerNodeStructType #328

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wemeetagain
Copy link
Member

Motivation

While doing gindex calculations on a BeaconState, noticed that there is a 'bug' in getting gindexes for validator entries.

Description

Remove the overridden getPropertyGindex that prevents calculation of gindices on a ContainerNodeStructType

@wemeetagain wemeetagain requested a review from a team as a code owner July 7, 2023 22:06
@github-actions github-actions bot added the ssz label Jul 7, 2023
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 554eab0 Previous: 424b426 Ratio
Copy Uint8Array 100000 slice arrayBuffer 122.20 us/op 368.89 us/op 0.33
Full benchmark results
Benchmark suite Current: 554eab0 Previous: 424b426 Ratio
digestTwoHashObjects 50023 times 69.005 ms/op 71.954 ms/op 0.96
digest64 50023 times 71.001 ms/op 76.204 ms/op 0.93
digest 50023 times 71.324 ms/op 76.420 ms/op 0.93
input length 32 1.6730 us/op 1.8190 us/op 0.92
input length 64 1.8110 us/op 1.9570 us/op 0.93
input length 128 3.1440 us/op 3.3660 us/op 0.93
input length 256 4.7850 us/op 4.9690 us/op 0.96
input length 512 7.9610 us/op 8.2010 us/op 0.97
input length 1024 15.592 us/op 16.485 us/op 0.95
digest 1000000 times 1.1631 s/op 1.3400 s/op 0.87
hashObjectToByteArray 50023 times 1.9044 ms/op 2.9160 ms/op 0.65
byteArrayToHashObject 50023 times 2.4838 ms/op 3.5609 ms/op 0.70
getGindicesAtDepth 5.5630 us/op 7.5680 us/op 0.74
iterateAtDepth 11.825 us/op 15.301 us/op 0.77
getGindexBits 586.00 ns/op 712.00 ns/op 0.82
gindexIterator 1.4760 us/op 1.5930 us/op 0.93
hash 2 Uint8Array 2250026 times - as-sha256 3.2199 s/op 3.3396 s/op 0.96
hashTwoObjects 2250026 times - as-sha256 3.1012 s/op 3.1476 s/op 0.99
hash 2 Uint8Array 2250026 times - noble 9.7256 s/op 11.176 s/op 0.87
hashTwoObjects 2250026 times - noble 12.811 s/op 14.279 s/op 0.90
getNodeH() x7812.5 avg hindex 21.115 us/op 29.523 us/op 0.72
getNodeH() x7812.5 index 0 7.1800 us/op 10.535 us/op 0.68
getNodeH() x7812.5 index 7 7.2260 us/op 10.493 us/op 0.69
getNodeH() x7812.5 index 7 with key array 7.2160 us/op 10.620 us/op 0.68
new LeafNode() x7812.5 316.20 us/op 375.93 us/op 0.84
multiproof - depth 15, 1 requested leaves 15.654 us/op 18.273 us/op 0.86
tree offset multiproof - depth 15, 1 requested leaves 33.714 us/op 40.358 us/op 0.84
compact multiproof - depth 15, 1 requested leaves 9.0380 us/op 10.022 us/op 0.90
multiproof - depth 15, 2 requested leaves 20.311 us/op 23.869 us/op 0.85
tree offset multiproof - depth 15, 2 requested leaves 35.700 us/op 42.270 us/op 0.84
compact multiproof - depth 15, 2 requested leaves 4.8760 us/op 5.7290 us/op 0.85
multiproof - depth 15, 3 requested leaves 27.440 us/op 34.297 us/op 0.80
tree offset multiproof - depth 15, 3 requested leaves 46.629 us/op 55.751 us/op 0.84
compact multiproof - depth 15, 3 requested leaves 10.304 us/op 11.642 us/op 0.89
multiproof - depth 15, 4 requested leaves 36.920 us/op 43.812 us/op 0.84
tree offset multiproof - depth 15, 4 requested leaves 58.815 us/op 72.380 us/op 0.81
compact multiproof - depth 15, 4 requested leaves 10.324 us/op 10.945 us/op 0.94
packedRootsBytesToLeafNodes bytes 4000 offset 0 3.2790 us/op 4.3620 us/op 0.75
packedRootsBytesToLeafNodes bytes 4000 offset 1 3.1810 us/op 4.3030 us/op 0.74
packedRootsBytesToLeafNodes bytes 4000 offset 2 3.1920 us/op 4.1200 us/op 0.77
packedRootsBytesToLeafNodes bytes 4000 offset 3 3.2960 us/op 4.1850 us/op 0.79
subtreeFillToContents depth 40 count 250000 74.552 ms/op 99.087 ms/op 0.75
setRoot - gindexBitstring 13.999 ms/op 16.396 ms/op 0.85
setRoot - gindex 15.939 ms/op 17.176 ms/op 0.93
getRoot - gindexBitstring 3.0647 ms/op 4.3627 ms/op 0.70
getRoot - gindex 4.3561 ms/op 5.2439 ms/op 0.83
getHashObject then setHashObject 17.292 ms/op 19.660 ms/op 0.88
setNodeWithFn 15.329 ms/op 16.319 ms/op 0.94
getNodeAtDepth depth 0 x100000 1.6111 ms/op 2.7441 ms/op 0.59
setNodeAtDepth depth 0 x100000 3.7032 ms/op 5.5937 ms/op 0.66
getNodesAtDepth depth 0 x100000 1.4169 ms/op 2.2724 ms/op 0.62
setNodesAtDepth depth 0 x100000 1.9718 ms/op 2.9080 ms/op 0.68
getNodeAtDepth depth 1 x100000 1.7328 ms/op 2.7632 ms/op 0.63
setNodeAtDepth depth 1 x100000 7.9497 ms/op 11.635 ms/op 0.68
getNodesAtDepth depth 1 x100000 1.6050 ms/op 2.4039 ms/op 0.67
setNodesAtDepth depth 1 x100000 7.4324 ms/op 9.2668 ms/op 0.80
getNodeAtDepth depth 2 x100000 2.1944 ms/op 3.3596 ms/op 0.65
setNodeAtDepth depth 2 x100000 14.982 ms/op 19.549 ms/op 0.77
getNodesAtDepth depth 2 x100000 27.524 ms/op 34.341 ms/op 0.80
setNodesAtDepth depth 2 x100000 24.092 ms/op 28.957 ms/op 0.83
tree.getNodesAtDepth - gindexes 8.1083 ms/op 11.643 ms/op 0.70
tree.getNodesAtDepth - push all nodes 2.5755 ms/op 3.7390 ms/op 0.69
tree.getNodesAtDepth - navigation 201.54 us/op 204.65 us/op 0.98
tree.setNodesAtDepth - indexes 608.25 us/op 757.39 us/op 0.80
set at depth 8 797.00 ns/op 932.00 ns/op 0.86
set at depth 16 1.1470 us/op 1.2410 us/op 0.92
set at depth 32 1.6790 us/op 1.8840 us/op 0.89
iterateNodesAtDepth 8 256 19.071 us/op 28.085 us/op 0.68
getNodesAtDepth 8 256 4.6800 us/op 7.0530 us/op 0.66
iterateNodesAtDepth 16 65536 5.4977 ms/op 7.8866 ms/op 0.70
getNodesAtDepth 16 65536 2.3467 ms/op 3.1553 ms/op 0.74
iterateNodesAtDepth 32 250000 20.399 ms/op 29.455 ms/op 0.69
getNodesAtDepth 32 250000 6.8907 ms/op 8.7048 ms/op 0.79
iterateNodesAtDepth 40 250000 20.591 ms/op 29.518 ms/op 0.70
getNodesAtDepth 40 250000 6.5572 ms/op 9.1829 ms/op 0.71
250k validators 13.786 s/op 15.091 s/op 0.91
bitlist bytes to struct (120,90) 996.00 ns/op 1.2680 us/op 0.79
bitlist bytes to tree (120,90) 4.3740 us/op 4.4700 us/op 0.98
bitlist bytes to struct (2048,2048) 2.1000 us/op 2.2890 us/op 0.92
bitlist bytes to tree (2048,2048) 6.6680 us/op 7.9700 us/op 0.84
ByteListType - deserialize 19.255 ms/op 21.139 ms/op 0.91
BasicListType - deserialize 13.936 ms/op 18.531 ms/op 0.75
ByteListType - serialize 18.412 ms/op 22.264 ms/op 0.83
BasicListType - serialize 24.410 ms/op 27.749 ms/op 0.88
BasicListType - tree_convertToStruct 34.285 ms/op 49.192 ms/op 0.70
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.9387 ms/op 7.3802 ms/op 0.67
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.5251 ms/op 7.5909 ms/op 0.60
Array.push len 300000 empty Array - number 8.5363 ms/op 9.3558 ms/op 0.91
Array.set len 300000 from new Array - number 2.2871 ms/op 3.1044 ms/op 0.74
Array.set len 300000 - number 7.2263 ms/op 10.339 ms/op 0.70
Uint8Array.set len 300000 257.85 us/op 307.73 us/op 0.84
Uint32Array.set len 300000 356.12 us/op 486.46 us/op 0.73
Container({a: uint8, b: uint8}) getViewDU x300000 32.395 ms/op 40.347 ms/op 0.80
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.810 ms/op 15.434 ms/op 0.83
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 487.06 ms/op 654.82 ms/op 0.74
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 443.80 ms/op 553.78 ms/op 0.80
List(Container) len 300000 ViewDU.get(i) 10.803 ms/op 17.891 ms/op 0.60
List(Container) len 300000 ViewDU.getReadonly(i) 10.159 ms/op 17.195 ms/op 0.59
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 49.438 ms/op 68.792 ms/op 0.72
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 8.5138 ms/op 9.2569 ms/op 0.92
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 9.5188 ms/op 13.524 ms/op 0.70
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 9.1120 ms/op 13.529 ms/op 0.67
Array.push len 300000 empty Array - object 8.4609 ms/op 9.9088 ms/op 0.85
Array.set len 300000 from new Array - object 3.1725 ms/op 3.9871 ms/op 0.80
Array.set len 300000 - object 8.1490 ms/op 10.127 ms/op 0.80
cachePermanentRootStruct no cache 13.905 us/op 14.991 us/op 0.93
cachePermanentRootStruct with cache 343.00 ns/op 374.00 ns/op 0.92
epochParticipation len 250000 rws 7813 3.2420 ms/op 3.9430 ms/op 0.82
deserialize Attestation - tree 4.9190 us/op 5.6710 us/op 0.87
deserialize Attestation - struct 3.3870 us/op 3.7620 us/op 0.90
deserialize SignedAggregateAndProof - tree 6.4060 us/op 7.3520 us/op 0.87
deserialize SignedAggregateAndProof - struct 5.3560 us/op 6.0580 us/op 0.88
deserialize SyncCommitteeMessage - tree 1.7570 us/op 1.9190 us/op 0.92
deserialize SyncCommitteeMessage - struct 2.2010 us/op 2.2800 us/op 0.97
deserialize SignedContributionAndProof - tree 3.0210 us/op 3.9540 us/op 0.76
deserialize SignedContributionAndProof - struct 4.8680 us/op 5.3550 us/op 0.91
deserialize SignedBeaconBlock - tree 344.14 us/op 432.46 us/op 0.80
deserialize SignedBeaconBlock - struct 215.33 us/op 278.17 us/op 0.77
BeaconState vc 300000 - deserialize tree 863.18 ms/op 1.1879 s/op 0.73
BeaconState vc 300000 - serialize tree 231.06 ms/op 338.56 ms/op 0.68
BeaconState.historicalRoots vc 300000 - deserialize tree 1.1850 us/op 1.3620 us/op 0.87
BeaconState.historicalRoots vc 300000 - serialize tree 1.3370 us/op 1.5360 us/op 0.87
BeaconState.validators vc 300000 - deserialize tree 847.54 ms/op 1.1528 s/op 0.74
BeaconState.validators vc 300000 - serialize tree 212.94 ms/op 296.56 ms/op 0.72
BeaconState.balances vc 300000 - deserialize tree 35.836 ms/op 43.553 ms/op 0.82
BeaconState.balances vc 300000 - serialize tree 4.3116 ms/op 7.3218 ms/op 0.59
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 508.11 us/op 952.54 us/op 0.53
BeaconState.previousEpochParticipation vc 300000 - serialize tree 350.75 us/op 549.41 us/op 0.64
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 535.99 us/op 932.50 us/op 0.57
BeaconState.currentEpochParticipation vc 300000 - serialize tree 350.84 us/op 542.25 us/op 0.65
BeaconState.inactivityScores vc 300000 - deserialize tree 26.846 ms/op 46.199 ms/op 0.58
BeaconState.inactivityScores vc 300000 - serialize tree 6.6492 ms/op 4.8675 ms/op 1.37
hashTreeRoot Attestation - struct 55.484 us/op 37.432 us/op 1.48
hashTreeRoot Attestation - tree 27.893 us/op 26.725 us/op 1.04
hashTreeRoot SignedAggregateAndProof - struct 77.800 us/op 55.654 us/op 1.40
hashTreeRoot SignedAggregateAndProof - tree 42.478 us/op 41.980 us/op 1.01
hashTreeRoot SyncCommitteeMessage - struct 19.959 us/op 14.162 us/op 1.41
hashTreeRoot SyncCommitteeMessage - tree 9.2770 us/op 9.2760 us/op 1.00
hashTreeRoot SignedContributionAndProof - struct 53.853 us/op 39.381 us/op 1.37
hashTreeRoot SignedContributionAndProof - tree 33.462 us/op 28.188 us/op 1.19
hashTreeRoot SignedBeaconBlock - struct 4.1337 ms/op 3.6571 ms/op 1.13
hashTreeRoot SignedBeaconBlock - tree 2.4216 ms/op 2.4954 ms/op 0.97
hashTreeRoot Validator - struct 20.963 us/op 20.543 us/op 1.02
hashTreeRoot Validator - tree 17.090 us/op 16.774 us/op 1.02
BeaconState vc 300000 - hashTreeRoot tree 5.2813 s/op 5.5831 s/op 0.95
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 2.2520 us/op 2.2510 us/op 1.00
BeaconState.validators vc 300000 - hashTreeRoot tree 4.9575 s/op 5.2485 s/op 0.94
BeaconState.balances vc 300000 - hashTreeRoot tree 129.68 ms/op 137.04 ms/op 0.95
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 13.149 ms/op 13.310 ms/op 0.99
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 13.149 ms/op 13.309 ms/op 0.99
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 119.41 ms/op 141.92 ms/op 0.84
hash64 x18 27.950 us/op 29.408 us/op 0.95
hashTwoObjects x18 25.960 us/op 25.685 us/op 1.01
hash64 x1740 2.6458 ms/op 2.7745 ms/op 0.95
hashTwoObjects x1740 2.4662 ms/op 2.4455 ms/op 1.01
hash64 x2700000 4.0912 s/op 4.2829 s/op 0.96
hashTwoObjects x2700000 3.8068 s/op 3.8507 s/op 0.99
get_exitEpoch - ContainerType 476.00 ns/op 598.00 ns/op 0.80
get_exitEpoch - ContainerNodeStructType 409.00 ns/op 492.00 ns/op 0.83
set_exitEpoch - ContainerType 435.00 ns/op 558.00 ns/op 0.78
set_exitEpoch - ContainerNodeStructType 420.00 ns/op 525.00 ns/op 0.80
get_pubkey - ContainerType 1.8120 us/op 1.9600 us/op 0.92
get_pubkey - ContainerNodeStructType 311.00 ns/op 368.00 ns/op 0.85
hashTreeRoot - ContainerType 512.00 ns/op 591.00 ns/op 0.87
hashTreeRoot - ContainerNodeStructType 590.00 ns/op 701.00 ns/op 0.84
createProof - ContainerType 6.7970 us/op 7.5710 us/op 0.90
createProof - ContainerNodeStructType 22.413 us/op 41.317 us/op 0.54
serialize - ContainerType 3.1610 us/op 3.5400 us/op 0.89
serialize - ContainerNodeStructType 2.6400 us/op 2.9130 us/op 0.91
set_exitEpoch_and_hashTreeRoot - ContainerType 6.3250 us/op 6.7070 us/op 0.94
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 18.223 us/op 18.693 us/op 0.97
Array - for of 12.477 us/op 12.697 us/op 0.98
Array - for(;;) 11.297 us/op 8.6780 us/op 1.30
basicListValue.readonlyValuesArray() 4.8502 ms/op 6.8312 ms/op 0.71
basicListValue.readonlyValuesArray() + loop all 5.2813 ms/op 6.9100 ms/op 0.76
compositeListValue.readonlyValuesArray() 34.871 ms/op 44.457 ms/op 0.78
compositeListValue.readonlyValuesArray() + loop all 33.254 ms/op 45.744 ms/op 0.73
Number64UintType - get balances list 5.8506 ms/op 7.2948 ms/op 0.80
Number64UintType - set balances list 14.701 ms/op 16.276 ms/op 0.90
Number64UintType - get and increase 10 then set 53.518 ms/op 67.958 ms/op 0.79
Number64UintType - increase 10 using applyDelta 23.143 ms/op 29.416 ms/op 0.79
Number64UintType - increase 10 using applyDeltaInBatch 23.095 ms/op 29.653 ms/op 0.78
tree_newTreeFromUint64Deltas 23.343 ms/op 32.880 ms/op 0.71
unsafeUint8ArrayToTree 42.459 ms/op 55.172 ms/op 0.77
bitLength(50) 328.00 ns/op 352.00 ns/op 0.93
bitLengthStr(50) 363.00 ns/op 428.00 ns/op 0.85
bitLength(8000) 309.00 ns/op 356.00 ns/op 0.87
bitLengthStr(8000) 420.00 ns/op 587.00 ns/op 0.72
bitLength(250000) 322.00 ns/op 358.00 ns/op 0.90
bitLengthStr(250000) 472.00 ns/op 698.00 ns/op 0.68
floor - Math.floor (53) 0.60284 ns/op 0.80454 ns/op 0.75
floor - << 0 (53) 0.60295 ns/op 0.80429 ns/op 0.75
floor - Math.floor (512) 0.60284 ns/op 0.80409 ns/op 0.75
floor - << 0 (512) 0.60306 ns/op 0.80403 ns/op 0.75
fnIf(0) 2.0140 ns/op 3.2150 ns/op 0.63
fnSwitch(0) 3.3532 ns/op 6.0318 ns/op 0.56
fnObj(0) 0.60284 ns/op 0.80424 ns/op 0.75
fnArr(0) 0.60290 ns/op 0.80400 ns/op 0.75
fnIf(4) 3.1612 ns/op 5.2256 ns/op 0.60
fnSwitch(4) 3.2597 ns/op 6.0286 ns/op 0.54
fnObj(4) 0.60290 ns/op 0.80404 ns/op 0.75
fnArr(4) 0.60271 ns/op 0.80403 ns/op 0.75
fnIf(9) 5.2342 ns/op 8.0400 ns/op 0.65
fnSwitch(9) 3.3088 ns/op 6.0287 ns/op 0.55
fnObj(9) 0.60294 ns/op 0.80409 ns/op 0.75
fnArr(9) 0.60273 ns/op 0.80430 ns/op 0.75
Container {a,b,vec} - as struct x100000 60.526 us/op 80.856 us/op 0.75
Container {a,b,vec} - as tree x100000 506.32 us/op 1.0048 ms/op 0.50
Container {a,vec,b} - as struct x100000 120.79 us/op 121.00 us/op 1.00
Container {a,vec,b} - as tree x100000 544.80 us/op 1.0855 ms/op 0.50
get 2 props x1000000 - rawObject 402.17 us/op 402.40 us/op 1.00
get 2 props x1000000 - proxy 90.862 ms/op 160.52 ms/op 0.57
get 2 props x1000000 - customObj 402.08 us/op 402.84 us/op 1.00
Simple object binary -> struct 821.00 ns/op 948.00 ns/op 0.87
Simple object binary -> tree_backed 2.5920 us/op 2.8130 us/op 0.92
Simple object struct -> tree_backed 3.4340 us/op 3.7160 us/op 0.92
Simple object tree_backed -> struct 3.0160 us/op 3.2870 us/op 0.92
Simple object struct -> binary 1.6730 us/op 1.7230 us/op 0.97
Simple object tree_backed -> binary 2.6440 us/op 3.0010 us/op 0.88
aggregationBits binary -> struct 735.00 ns/op 808.00 ns/op 0.91
aggregationBits binary -> tree_backed 3.6280 us/op 4.0050 us/op 0.91
aggregationBits struct -> tree_backed 4.4510 us/op 4.8690 us/op 0.91
aggregationBits tree_backed -> struct 1.8340 us/op 2.0240 us/op 0.91
aggregationBits struct -> binary 1.3510 us/op 1.5220 us/op 0.89
aggregationBits tree_backed -> binary 1.6230 us/op 1.7520 us/op 0.93
List(uint8) 100000 binary -> struct 1.9221 ms/op 2.2165 ms/op 0.87
List(uint8) 100000 binary -> tree_backed 155.97 us/op 186.19 us/op 0.84
List(uint8) 100000 struct -> tree_backed 1.8636 ms/op 2.5125 ms/op 0.74
List(uint8) 100000 tree_backed -> struct 1.2692 ms/op 1.7674 ms/op 0.72
List(uint8) 100000 struct -> binary 1.6620 ms/op 2.2892 ms/op 0.73
List(uint8) 100000 tree_backed -> binary 93.284 us/op 168.82 us/op 0.55
List(uint64Number) 100000 binary -> struct 1.5180 ms/op 2.0001 ms/op 0.76
List(uint64Number) 100000 binary -> tree_backed 4.5145 ms/op 6.4006 ms/op 0.71
List(uint64Number) 100000 struct -> tree_backed 6.5076 ms/op 9.5213 ms/op 0.68
List(uint64Number) 100000 tree_backed -> struct 2.6319 ms/op 3.7990 ms/op 0.69
List(uint64Number) 100000 struct -> binary 2.0105 ms/op 2.7629 ms/op 0.73
List(uint64Number) 100000 tree_backed -> binary 1.0649 ms/op 1.9558 ms/op 0.54
List(Uint64Bigint) 100000 binary -> struct 4.4815 ms/op 6.4068 ms/op 0.70
List(Uint64Bigint) 100000 binary -> tree_backed 5.4548 ms/op 6.5700 ms/op 0.83
List(Uint64Bigint) 100000 struct -> tree_backed 8.0421 ms/op 10.878 ms/op 0.74
List(Uint64Bigint) 100000 tree_backed -> struct 5.7155 ms/op 8.6961 ms/op 0.66
List(Uint64Bigint) 100000 struct -> binary 2.6269 ms/op 3.4912 ms/op 0.75
List(Uint64Bigint) 100000 tree_backed -> binary 1.0723 ms/op 1.9613 ms/op 0.55
Vector(Root) 100000 binary -> struct 42.502 ms/op 61.582 ms/op 0.69
Vector(Root) 100000 binary -> tree_backed 50.500 ms/op 65.884 ms/op 0.77
Vector(Root) 100000 struct -> tree_backed 61.282 ms/op 76.413 ms/op 0.80
Vector(Root) 100000 tree_backed -> struct 66.766 ms/op 85.290 ms/op 0.78
Vector(Root) 100000 struct -> binary 2.6300 ms/op 3.7747 ms/op 0.70
Vector(Root) 100000 tree_backed -> binary 12.332 ms/op 16.025 ms/op 0.77
List(Validator) 100000 binary -> struct 175.66 ms/op 217.52 ms/op 0.81
List(Validator) 100000 binary -> tree_backed 469.40 ms/op 561.24 ms/op 0.84
List(Validator) 100000 struct -> tree_backed 511.29 ms/op 648.60 ms/op 0.79
List(Validator) 100000 tree_backed -> struct 272.17 ms/op 362.87 ms/op 0.75
List(Validator) 100000 struct -> binary 41.460 ms/op 57.633 ms/op 0.72
List(Validator) 100000 tree_backed -> binary 113.63 ms/op 163.55 ms/op 0.69
List(Validator-NS) 100000 binary -> struct 173.71 ms/op 240.26 ms/op 0.72
List(Validator-NS) 100000 binary -> tree_backed 243.13 ms/op 316.01 ms/op 0.77
List(Validator-NS) 100000 struct -> tree_backed 297.22 ms/op 391.67 ms/op 0.76
List(Validator-NS) 100000 tree_backed -> struct 244.68 ms/op 329.13 ms/op 0.74
List(Validator-NS) 100000 struct -> binary 41.589 ms/op 56.102 ms/op 0.74
List(Validator-NS) 100000 tree_backed -> binary 51.966 ms/op 63.975 ms/op 0.81
get epochStatuses - MutableVector 98.708 us/op 140.43 us/op 0.70
get epochStatuses - ViewDU 285.32 us/op 338.51 us/op 0.84
set epochStatuses - ListTreeView 1.9204 ms/op 2.4744 ms/op 0.78
set epochStatuses - ListTreeView - set() 602.05 us/op 734.12 us/op 0.82
set epochStatuses - ListTreeView - commit() 571.42 us/op 749.42 us/op 0.76
bitstring 926.87 ns/op 897.68 ns/op 1.03
bit mask 14.460 ns/op 15.360 ns/op 0.94
struct - increase slot to 1000000 1.6046 ms/op 2.6267 ms/op 0.61
UintNumberType - increase slot to 1000000 36.442 ms/op 59.181 ms/op 0.62
UintBigintType - increase slot to 1000000 553.26 ms/op 731.29 ms/op 0.76
UintBigint8 x 100000 tree_deserialize 5.6825 ms/op 9.5016 ms/op 0.60
UintBigint8 x 100000 tree_serialize 1.4535 ms/op 2.4304 ms/op 0.60
UintBigint16 x 100000 tree_deserialize 5.5812 ms/op 9.6428 ms/op 0.58
UintBigint16 x 100000 tree_serialize 1.7016 ms/op 1.3983 ms/op 1.22
UintBigint32 x 100000 tree_deserialize 7.1647 ms/op 9.5877 ms/op 0.75
UintBigint32 x 100000 tree_serialize 1.8320 ms/op 2.5093 ms/op 0.73
UintBigint64 x 100000 tree_deserialize 8.4141 ms/op 11.268 ms/op 0.75
UintBigint64 x 100000 tree_serialize 2.1171 ms/op 3.2807 ms/op 0.65
UintBigint8 x 100000 value_deserialize 534.57 us/op 1.0450 ms/op 0.51
UintBigint8 x 100000 value_serialize 965.71 us/op 1.5444 ms/op 0.63
UintBigint16 x 100000 value_deserialize 579.02 us/op 1.1180 ms/op 0.52
UintBigint16 x 100000 value_serialize 981.90 us/op 1.7238 ms/op 0.57
UintBigint32 x 100000 value_deserialize 542.79 us/op 1.0084 ms/op 0.54
UintBigint32 x 100000 value_serialize 976.80 us/op 1.6840 ms/op 0.58
UintBigint64 x 100000 value_deserialize 606.66 us/op 1.0890 ms/op 0.56
UintBigint64 x 100000 value_serialize 1.2450 ms/op 1.8802 ms/op 0.66
UintBigint8 x 100000 deserialize 5.8580 ms/op 8.0396 ms/op 0.73
UintBigint8 x 100000 serialize 1.9764 ms/op 3.1433 ms/op 0.63
UintBigint16 x 100000 deserialize 5.9190 ms/op 8.3254 ms/op 0.71
UintBigint16 x 100000 serialize 2.0558 ms/op 3.1827 ms/op 0.65
UintBigint32 x 100000 deserialize 6.9432 ms/op 9.7740 ms/op 0.71
UintBigint32 x 100000 serialize 3.6934 ms/op 5.2074 ms/op 0.71
UintBigint64 x 100000 deserialize 4.6258 ms/op 6.4865 ms/op 0.71
UintBigint64 x 100000 serialize 1.8987 ms/op 2.9357 ms/op 0.65
UintBigint128 x 100000 deserialize 7.0420 ms/op 10.053 ms/op 0.70
UintBigint128 x 100000 serialize 21.341 ms/op 33.558 ms/op 0.64
UintBigint256 x 100000 deserialize 13.472 ms/op 18.918 ms/op 0.71
UintBigint256 x 100000 serialize 63.754 ms/op 98.422 ms/op 0.65
Slice from Uint8Array x25000 1.4108 ms/op 1.8434 ms/op 0.77
Slice from ArrayBuffer x25000 30.079 ms/op 34.533 ms/op 0.87
Slice from ArrayBuffer x25000 + new Uint8Array 32.387 ms/op 37.715 ms/op 0.86
Copy Uint8Array 100000 iterate 1.0575 ms/op 1.7642 ms/op 0.60
Copy Uint8Array 100000 slice 112.48 us/op 156.92 us/op 0.72
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 114.03 us/op 166.57 us/op 0.68
Copy Buffer 100000 Uint8Array.prototype.slice.call 116.71 us/op 164.95 us/op 0.71
Copy Uint8Array 100000 slice + set 269.17 us/op 392.62 us/op 0.69
Copy Uint8Array 100000 subarray + set 121.71 us/op 299.84 us/op 0.41
Copy Uint8Array 100000 slice arrayBuffer 122.20 us/op 368.89 us/op 0.33
Uint64 deserialize 100000 - iterate Uint8Array 2.1681 ms/op 2.6314 ms/op 0.82
Uint64 deserialize 100000 - by Uint32A 2.0923 ms/op 2.4861 ms/op 0.84
Uint64 deserialize 100000 - by DataView.getUint32 x2 2.0729 ms/op 2.5506 ms/op 0.81
Uint64 deserialize 100000 - by DataView.getBigUint64 5.9446 ms/op 7.9087 ms/op 0.75
Uint64 deserialize 100000 - by byte 72.394 ms/op 82.760 ms/op 0.87

by benchmarkbot/action

@@ -77,9 +77,6 @@ export class ContainerNodeStructType<Fields extends Record<string, Type<unknown>

// ContainerNodeStructType can only parse proofs that contain all the data.
// TODO: Support converting a partial tree to a partial value
getPropertyGindex(): null {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while since I dealt with this code, but what about the comment?

ContainerNodeStructType can only parse proofs that contain all the data

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with the comment. I can put in a more effort to make the UX a bit nicer here

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.

2 participants