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: add sliceFrom to ListCompositeTreeViewDU #366

Merged
merged 9 commits into from
Apr 19, 2024
Merged

Conversation

ensi321
Copy link
Contributor

@ensi321 ensi321 commented Apr 3, 2024

Add sliceFrom to ListCompositeTreeViewDU.

Used in EIP-7251 to slice various beacon state fields like pendingBalanceDeposit, pendingConsolidation during epoch processing.

Refer to the spec for more details:
process_pending_balance_deposits
process_pending_consolidations
process_withdrawals

@github-actions github-actions bot added the ssz label Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 4de4857 Previous: 3cc1529 Ratio
digestTwoHashObjects 50023 times 48.080 ms/op 47.894 ms/op 1.00
digest64 50023 times 50.182 ms/op 50.094 ms/op 1.00
digest 50023 times 58.375 ms/op 54.091 ms/op 1.08
input length 32 1.4060 us/op 1.4320 us/op 0.98
input length 64 1.5320 us/op 1.5520 us/op 0.99
input length 128 2.5220 us/op 2.5200 us/op 1.00
input length 256 3.6160 us/op 3.6330 us/op 1.00
input length 512 6.0090 us/op 5.8000 us/op 1.04
input length 1024 11.589 us/op 11.027 us/op 1.05
digest 1000000 times 844.49 ms/op 868.98 ms/op 0.97
hashObjectToByteArray 50023 times 1.4249 ms/op 1.4282 ms/op 1.00
byteArrayToHashObject 50023 times 3.5420 ms/op 3.7297 ms/op 0.95
getGindicesAtDepth 4.9910 us/op 5.2900 us/op 0.94
iterateAtDepth 10.106 us/op 10.154 us/op 1.00
getGindexBits 551.00 ns/op 552.00 ns/op 1.00
gindexIterator 1.1910 us/op 1.2320 us/op 0.97
hash 2 Uint8Array 2250026 times - as-sha256 2.4055 s/op 2.3137 s/op 1.04
hashTwoObjects 2250026 times - as-sha256 2.3663 s/op 2.2997 s/op 1.03
hash 2 Uint8Array 2250026 times - noble 5.8877 s/op 6.0961 s/op 0.97
hashTwoObjects 2250026 times - noble 7.1476 s/op 7.4906 s/op 0.95
getNodeH() x7812.5 avg hindex 15.868 us/op 15.351 us/op 1.03
getNodeH() x7812.5 index 0 5.2660 us/op 5.2380 us/op 1.01
getNodeH() x7812.5 index 7 5.2290 us/op 5.2550 us/op 1.00
getNodeH() x7812.5 index 7 with key array 5.2190 us/op 5.3930 us/op 0.97
new LeafNode() x7812.5 194.31 us/op 202.82 us/op 0.96
multiproof - depth 15, 1 requested leaves 11.248 us/op 10.674 us/op 1.05
tree offset multiproof - depth 15, 1 requested leaves 21.243 us/op 20.967 us/op 1.01
compact multiproof - depth 15, 1 requested leaves 5.8670 us/op 5.6930 us/op 1.03
multiproof - depth 15, 2 requested leaves 13.973 us/op 14.763 us/op 0.95
tree offset multiproof - depth 15, 2 requested leaves 24.925 us/op 25.817 us/op 0.97
compact multiproof - depth 15, 2 requested leaves 3.5280 us/op 3.3740 us/op 1.05
multiproof - depth 15, 3 requested leaves 19.592 us/op 21.149 us/op 0.93
tree offset multiproof - depth 15, 3 requested leaves 33.271 us/op 33.453 us/op 0.99
compact multiproof - depth 15, 3 requested leaves 5.8830 us/op 4.9030 us/op 1.20
multiproof - depth 15, 4 requested leaves 25.278 us/op 25.679 us/op 0.98
tree offset multiproof - depth 15, 4 requested leaves 38.390 us/op 40.258 us/op 0.95
compact multiproof - depth 15, 4 requested leaves 5.8320 us/op 5.7720 us/op 1.01
packedRootsBytesToLeafNodes bytes 4000 offset 0 2.1000 us/op 2.0630 us/op 1.02
packedRootsBytesToLeafNodes bytes 4000 offset 1 2.0790 us/op 2.0650 us/op 1.01
packedRootsBytesToLeafNodes bytes 4000 offset 2 2.0960 us/op 2.0430 us/op 1.03
packedRootsBytesToLeafNodes bytes 4000 offset 3 2.0850 us/op 2.0150 us/op 1.03
subtreeFillToContents depth 40 count 250000 47.419 ms/op 45.819 ms/op 1.03
setRoot - gindexBitstring 9.1244 ms/op 8.9309 ms/op 1.02
setRoot - gindex 9.8122 ms/op 8.8490 ms/op 1.11
getRoot - gindexBitstring 2.6269 ms/op 2.5172 ms/op 1.04
getRoot - gindex 3.1153 ms/op 3.2696 ms/op 0.95
getHashObject then setHashObject 10.503 ms/op 9.2311 ms/op 1.14
setNodeWithFn 9.1353 ms/op 7.9660 ms/op 1.15
getNodeAtDepth depth 0 x100000 1.1442 ms/op 1.1450 ms/op 1.00
setNodeAtDepth depth 0 x100000 2.7213 ms/op 2.3412 ms/op 1.16
getNodesAtDepth depth 0 x100000 1.0977 ms/op 1.0847 ms/op 1.01
setNodesAtDepth depth 0 x100000 1.4842 ms/op 1.5080 ms/op 0.98
getNodeAtDepth depth 1 x100000 1.2310 ms/op 1.2073 ms/op 1.02
setNodeAtDepth depth 1 x100000 5.7943 ms/op 5.9306 ms/op 0.98
getNodesAtDepth depth 1 x100000 1.2075 ms/op 1.2096 ms/op 1.00
setNodesAtDepth depth 1 x100000 4.8615 ms/op 4.4832 ms/op 1.08
getNodeAtDepth depth 2 x100000 1.4824 ms/op 1.5225 ms/op 0.97
setNodeAtDepth depth 2 x100000 9.9088 ms/op 8.9660 ms/op 1.11
getNodesAtDepth depth 2 x100000 20.517 ms/op 20.326 ms/op 1.01
setNodesAtDepth depth 2 x100000 13.676 ms/op 12.670 ms/op 1.08
tree.getNodesAtDepth - gindexes 6.7580 ms/op 6.4969 ms/op 1.04
tree.getNodesAtDepth - push all nodes 2.1930 ms/op 1.8195 ms/op 1.21
tree.getNodesAtDepth - navigation 158.01 us/op 155.63 us/op 1.02
tree.setNodesAtDepth - indexes 386.03 us/op 366.73 us/op 1.05
set at depth 8 533.00 ns/op 501.00 ns/op 1.06
set at depth 16 769.00 ns/op 634.00 ns/op 1.21
set at depth 32 1.1400 us/op 956.00 ns/op 1.19
iterateNodesAtDepth 8 256 15.475 us/op 14.213 us/op 1.09
getNodesAtDepth 8 256 3.7960 us/op 3.5310 us/op 1.08
iterateNodesAtDepth 16 65536 4.6071 ms/op 4.5086 ms/op 1.02
getNodesAtDepth 16 65536 1.9585 ms/op 1.5809 ms/op 1.24
iterateNodesAtDepth 32 250000 16.194 ms/op 15.892 ms/op 1.02
getNodesAtDepth 32 250000 4.3143 ms/op 4.2252 ms/op 1.02
iterateNodesAtDepth 40 250000 15.027 ms/op 17.827 ms/op 0.84
getNodesAtDepth 40 250000 4.2451 ms/op 4.4009 ms/op 0.96
250k validators 7.1206 s/op 7.7847 s/op 0.91
bitlist bytes to struct (120,90) 577.00 ns/op 582.00 ns/op 0.99
bitlist bytes to tree (120,90) 2.2670 us/op 2.3610 us/op 0.96
bitlist bytes to struct (2048,2048) 993.00 ns/op 1.0310 us/op 0.96
bitlist bytes to tree (2048,2048) 3.5640 us/op 3.6690 us/op 0.97
ByteListType - deserialize 8.3498 ms/op 9.7946 ms/op 0.85
BasicListType - deserialize 7.4743 ms/op 8.0304 ms/op 0.93
ByteListType - serialize 7.9805 ms/op 9.6016 ms/op 0.83
BasicListType - serialize 9.5900 ms/op 11.546 ms/op 0.83
BasicListType - tree_convertToStruct 21.151 ms/op 22.132 ms/op 0.96
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.1483 ms/op 4.4550 ms/op 0.93
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.1826 ms/op 4.1408 ms/op 1.01
Array.push len 300000 empty Array - number 6.2505 ms/op 6.9714 ms/op 0.90
Array.set len 300000 from new Array - number 1.6841 ms/op 1.7101 ms/op 0.98
Array.set len 300000 - number 5.1986 ms/op 5.8936 ms/op 0.88
Uint8Array.set len 300000 208.61 us/op 224.60 us/op 0.93
Uint32Array.set len 300000 289.38 us/op 321.76 us/op 0.90
Container({a: uint8, b: uint8}) getViewDU x300000 21.614 ms/op 20.640 ms/op 1.05
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 9.3300 ms/op 9.7688 ms/op 0.96
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 199.32 ms/op 209.34 ms/op 0.95
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 279.83 ms/op 299.51 ms/op 0.93
List(Container) len 300000 ViewDU.get(i) 6.6005 ms/op 6.7512 ms/op 0.98
List(Container) len 300000 ViewDU.getReadonly(i) 6.3668 ms/op 6.6863 ms/op 0.95
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 36.259 ms/op 38.046 ms/op 0.95
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.2163 ms/op 5.7025 ms/op 0.91
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.0152 ms/op 6.5848 ms/op 0.91
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 5.9718 ms/op 6.0988 ms/op 0.98
Array.push len 300000 empty Array - object 5.8595 ms/op 7.5555 ms/op 0.78
Array.set len 300000 from new Array - object 1.9201 ms/op 2.0111 ms/op 0.95
Array.set len 300000 - object 5.4363 ms/op 6.3727 ms/op 0.85
cachePermanentRootStruct no cache 9.0660 us/op 10.061 us/op 0.90
cachePermanentRootStruct with cache 222.00 ns/op 251.00 ns/op 0.88
epochParticipation len 250000 rws 7813 2.2888 ms/op 2.4110 ms/op 0.95
deserialize Attestation - tree 2.9340 us/op 3.4210 us/op 0.86
deserialize Attestation - struct 2.0850 us/op 2.2450 us/op 0.93
deserialize SignedAggregateAndProof - tree 3.7240 us/op 3.9750 us/op 0.94
deserialize SignedAggregateAndProof - struct 3.0430 us/op 3.2220 us/op 0.94
deserialize SyncCommitteeMessage - tree 1.1150 us/op 1.2660 us/op 0.88
deserialize SyncCommitteeMessage - struct 1.1770 us/op 1.3840 us/op 0.85
deserialize SignedContributionAndProof - tree 1.9860 us/op 2.0040 us/op 0.99
deserialize SignedContributionAndProof - struct 2.4280 us/op 2.7290 us/op 0.89
deserialize SignedBeaconBlock - tree 215.63 us/op 226.70 us/op 0.95
deserialize SignedBeaconBlock - struct 130.84 us/op 138.18 us/op 0.95
BeaconState vc 300000 - deserialize tree 544.43 ms/op 590.99 ms/op 0.92
BeaconState vc 300000 - serialize tree 117.33 ms/op 146.60 ms/op 0.80
BeaconState.historicalRoots vc 300000 - deserialize tree 876.00 ns/op 893.00 ns/op 0.98
BeaconState.historicalRoots vc 300000 - serialize tree 707.00 ns/op 797.00 ns/op 0.89
BeaconState.validators vc 300000 - deserialize tree 510.38 ms/op 568.23 ms/op 0.90
BeaconState.validators vc 300000 - serialize tree 99.453 ms/op 107.52 ms/op 0.92
BeaconState.balances vc 300000 - deserialize tree 19.110 ms/op 20.199 ms/op 0.95
BeaconState.balances vc 300000 - serialize tree 3.4773 ms/op 3.4919 ms/op 1.00
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 436.03 us/op 414.60 us/op 1.05
BeaconState.previousEpochParticipation vc 300000 - serialize tree 285.55 us/op 286.20 us/op 1.00
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 468.46 us/op 423.40 us/op 1.11
BeaconState.currentEpochParticipation vc 300000 - serialize tree 276.64 us/op 285.14 us/op 0.97
BeaconState.inactivityScores vc 300000 - deserialize tree 19.237 ms/op 21.689 ms/op 0.89
BeaconState.inactivityScores vc 300000 - serialize tree 2.8688 ms/op 2.9481 ms/op 0.97
hashTreeRoot Attestation - struct 29.209 us/op 27.329 us/op 1.07
hashTreeRoot Attestation - tree 20.063 us/op 18.415 us/op 1.09
hashTreeRoot SignedAggregateAndProof - struct 41.561 us/op 38.852 us/op 1.07
hashTreeRoot SignedAggregateAndProof - tree 27.913 us/op 27.973 us/op 1.00
hashTreeRoot SyncCommitteeMessage - struct 9.7290 us/op 9.2700 us/op 1.05
hashTreeRoot SyncCommitteeMessage - tree 6.2500 us/op 6.2290 us/op 1.00
hashTreeRoot SignedContributionAndProof - struct 27.231 us/op 26.332 us/op 1.03
hashTreeRoot SignedContributionAndProof - tree 20.025 us/op 19.560 us/op 1.02
hashTreeRoot SignedBeaconBlock - struct 2.3865 ms/op 2.2677 ms/op 1.05
hashTreeRoot SignedBeaconBlock - tree 1.6975 ms/op 1.6710 ms/op 1.02
hashTreeRoot Validator - struct 13.627 us/op 12.387 us/op 1.10
hashTreeRoot Validator - tree 11.738 us/op 10.597 us/op 1.11
BeaconState vc 300000 - hashTreeRoot tree 3.6800 s/op 3.7457 s/op 0.98
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.4720 us/op 1.5450 us/op 0.95
BeaconState.validators vc 300000 - hashTreeRoot tree 3.5032 s/op 3.6263 s/op 0.97
BeaconState.balances vc 300000 - hashTreeRoot tree 85.431 ms/op 87.438 ms/op 0.98
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 9.0800 ms/op 9.3044 ms/op 0.98
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 9.0665 ms/op 9.0739 ms/op 1.00
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 83.653 ms/op 82.887 ms/op 1.01
hash64 x18 19.553 us/op 19.376 us/op 1.01
hashTwoObjects x18 17.958 us/op 17.891 us/op 1.00
hash64 x1740 1.8353 ms/op 1.8392 ms/op 1.00
hashTwoObjects x1740 1.7069 ms/op 1.7013 ms/op 1.00
hash64 x2700000 2.8481 s/op 2.8764 s/op 0.99
hashTwoObjects x2700000 2.6566 s/op 2.6410 s/op 1.01
get_exitEpoch - ContainerType 206.00 ns/op 229.00 ns/op 0.90
get_exitEpoch - ContainerNodeStructType 198.00 ns/op 225.00 ns/op 0.88
set_exitEpoch - ContainerType 236.00 ns/op 264.00 ns/op 0.89
set_exitEpoch - ContainerNodeStructType 205.00 ns/op 237.00 ns/op 0.86
get_pubkey - ContainerType 1.0270 us/op 1.2400 us/op 0.83
get_pubkey - ContainerNodeStructType 207.00 ns/op 239.00 ns/op 0.87
hashTreeRoot - ContainerType 352.00 ns/op 458.00 ns/op 0.77
hashTreeRoot - ContainerNodeStructType 419.00 ns/op 482.00 ns/op 0.87
createProof - ContainerType 3.9810 us/op 4.3720 us/op 0.91
createProof - ContainerNodeStructType 21.147 us/op 23.898 us/op 0.88
serialize - ContainerType 1.7360 us/op 2.0600 us/op 0.84
serialize - ContainerNodeStructType 1.4510 us/op 1.7840 us/op 0.81
set_exitEpoch_and_hashTreeRoot - ContainerType 4.1520 us/op 4.1510 us/op 1.00
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 11.395 us/op 11.967 us/op 0.95
Array - for of 6.4490 us/op 6.4850 us/op 0.99
Array - for(;;) 5.7920 us/op 5.7380 us/op 1.01
basicListValue.readonlyValuesArray() 3.6102 ms/op 4.8126 ms/op 0.75
basicListValue.readonlyValuesArray() + loop all 3.7072 ms/op 4.8544 ms/op 0.76
compositeListValue.readonlyValuesArray() 26.641 ms/op 27.126 ms/op 0.98
compositeListValue.readonlyValuesArray() + loop all 24.814 ms/op 25.930 ms/op 0.96
Number64UintType - get balances list 4.2910 ms/op 4.9834 ms/op 0.86
Number64UintType - set balances list 10.083 ms/op 10.250 ms/op 0.98
Number64UintType - get and increase 10 then set 42.490 ms/op 44.041 ms/op 0.96
Number64UintType - increase 10 using applyDelta 16.173 ms/op 18.138 ms/op 0.89
Number64UintType - increase 10 using applyDeltaInBatch 16.310 ms/op 18.113 ms/op 0.90
tree_newTreeFromUint64Deltas 15.533 ms/op 16.718 ms/op 0.93
unsafeUint8ArrayToTree 30.404 ms/op 31.663 ms/op 0.96
bitLength(50) 231.00 ns/op 242.00 ns/op 0.95
bitLengthStr(50) 244.00 ns/op 253.00 ns/op 0.96
bitLength(8000) 219.00 ns/op 228.00 ns/op 0.96
bitLengthStr(8000) 279.00 ns/op 321.00 ns/op 0.87
bitLength(250000) 217.00 ns/op 237.00 ns/op 0.92
bitLengthStr(250000) 315.00 ns/op 365.00 ns/op 0.86
floor - Math.floor (53) 0.46457 ns/op 0.46887 ns/op 0.99
floor - << 0 (53) 0.46440 ns/op 0.46934 ns/op 0.99
floor - Math.floor (512) 0.46411 ns/op 0.46637 ns/op 1.00
floor - << 0 (512) 0.46409 ns/op 0.46632 ns/op 1.00
fnIf(0) 1.5486 ns/op 1.5464 ns/op 1.00
fnSwitch(0) 2.4738 ns/op 2.4742 ns/op 1.00
fnObj(0) 0.46481 ns/op 0.47002 ns/op 0.99
fnArr(0) 0.46654 ns/op 0.46435 ns/op 1.00
fnIf(4) 2.1661 ns/op 2.1635 ns/op 1.00
fnSwitch(4) 2.4738 ns/op 2.4755 ns/op 1.00
fnObj(4) 0.46585 ns/op 0.46459 ns/op 1.00
fnArr(4) 0.46716 ns/op 0.46601 ns/op 1.00
fnIf(9) 3.0927 ns/op 3.0920 ns/op 1.00
fnSwitch(9) 2.4738 ns/op 2.4752 ns/op 1.00
fnObj(9) 0.46531 ns/op 0.46512 ns/op 1.00
fnArr(9) 0.47076 ns/op 0.46388 ns/op 1.01
Container {a,b,vec} - as struct x100000 46.590 us/op 47.165 us/op 0.99
Container {a,b,vec} - as tree x100000 371.55 us/op 371.56 us/op 1.00
Container {a,vec,b} - as struct x100000 77.741 us/op 77.630 us/op 1.00
Container {a,vec,b} - as tree x100000 403.01 us/op 402.53 us/op 1.00
get 2 props x1000000 - rawObject 310.27 us/op 309.51 us/op 1.00
get 2 props x1000000 - proxy 87.174 ms/op 72.033 ms/op 1.21
get 2 props x1000000 - customObj 309.42 us/op 309.38 us/op 1.00
Simple object binary -> struct 653.00 ns/op 692.00 ns/op 0.94
Simple object binary -> tree_backed 1.7980 us/op 1.8690 us/op 0.96
Simple object struct -> tree_backed 2.3790 us/op 2.4730 us/op 0.96
Simple object tree_backed -> struct 1.9190 us/op 2.1150 us/op 0.91
Simple object struct -> binary 1000.0 ns/op 1.0480 us/op 0.95
Simple object tree_backed -> binary 1.6060 us/op 1.7010 us/op 0.94
aggregationBits binary -> struct 619.00 ns/op 655.00 ns/op 0.95
aggregationBits binary -> tree_backed 2.4830 us/op 2.5000 us/op 0.99
aggregationBits struct -> tree_backed 2.8720 us/op 2.9700 us/op 0.97
aggregationBits tree_backed -> struct 1.1910 us/op 1.2630 us/op 0.94
aggregationBits struct -> binary 866.00 ns/op 948.00 ns/op 0.91
aggregationBits tree_backed -> binary 1.0540 us/op 1.1480 us/op 0.92
List(uint8) 100000 binary -> struct 1.3454 ms/op 1.5116 ms/op 0.89
List(uint8) 100000 binary -> tree_backed 92.296 us/op 108.70 us/op 0.85
List(uint8) 100000 struct -> tree_backed 1.5152 ms/op 1.6695 ms/op 0.91
List(uint8) 100000 tree_backed -> struct 999.77 us/op 1.0388 ms/op 0.96
List(uint8) 100000 struct -> binary 1.3954 ms/op 1.3309 ms/op 1.05
List(uint8) 100000 tree_backed -> binary 83.014 us/op 88.419 us/op 0.94
List(uint64Number) 100000 binary -> struct 1.2805 ms/op 1.2796 ms/op 1.00
List(uint64Number) 100000 binary -> tree_backed 3.2820 ms/op 3.3190 ms/op 0.99
List(uint64Number) 100000 struct -> tree_backed 4.8990 ms/op 5.0399 ms/op 0.97
List(uint64Number) 100000 tree_backed -> struct 2.1956 ms/op 2.3314 ms/op 0.94
List(uint64Number) 100000 struct -> binary 1.6873 ms/op 1.6214 ms/op 1.04
List(uint64Number) 100000 tree_backed -> binary 820.74 us/op 870.97 us/op 0.94
List(Uint64Bigint) 100000 binary -> struct 3.3524 ms/op 3.5882 ms/op 0.93
List(Uint64Bigint) 100000 binary -> tree_backed 3.4107 ms/op 3.5092 ms/op 0.97
List(Uint64Bigint) 100000 struct -> tree_backed 5.5265 ms/op 5.6517 ms/op 0.98
List(Uint64Bigint) 100000 tree_backed -> struct 4.7228 ms/op 4.8316 ms/op 0.98
List(Uint64Bigint) 100000 struct -> binary 2.0431 ms/op 2.0800 ms/op 0.98
List(Uint64Bigint) 100000 tree_backed -> binary 1.1121 ms/op 1.4325 ms/op 0.78
Vector(Root) 100000 binary -> struct 26.823 ms/op 31.782 ms/op 0.84
Vector(Root) 100000 binary -> tree_backed 32.510 ms/op 26.664 ms/op 1.22
Vector(Root) 100000 struct -> tree_backed 35.161 ms/op 36.432 ms/op 0.97
Vector(Root) 100000 tree_backed -> struct 45.439 ms/op 45.920 ms/op 0.99
Vector(Root) 100000 struct -> binary 1.9765 ms/op 1.9467 ms/op 1.02
Vector(Root) 100000 tree_backed -> binary 9.9795 ms/op 10.761 ms/op 0.93
List(Validator) 100000 binary -> struct 103.85 ms/op 104.70 ms/op 0.99
List(Validator) 100000 binary -> tree_backed 293.21 ms/op 279.58 ms/op 1.05
List(Validator) 100000 struct -> tree_backed 320.06 ms/op 316.53 ms/op 1.01
List(Validator) 100000 tree_backed -> struct 203.96 ms/op 203.05 ms/op 1.00
List(Validator) 100000 struct -> binary 30.991 ms/op 33.443 ms/op 0.93
List(Validator) 100000 tree_backed -> binary 99.487 ms/op 103.08 ms/op 0.97
List(Validator-NS) 100000 binary -> struct 99.770 ms/op 99.684 ms/op 1.00
List(Validator-NS) 100000 binary -> tree_backed 162.63 ms/op 151.15 ms/op 1.08
List(Validator-NS) 100000 struct -> tree_backed 197.28 ms/op 193.92 ms/op 1.02
List(Validator-NS) 100000 tree_backed -> struct 153.24 ms/op 154.35 ms/op 0.99
List(Validator-NS) 100000 struct -> binary 30.601 ms/op 32.969 ms/op 0.93
List(Validator-NS) 100000 tree_backed -> binary 36.422 ms/op 35.860 ms/op 1.02
get epochStatuses - MutableVector 96.831 us/op 100.66 us/op 0.96
get epochStatuses - ViewDU 200.81 us/op 202.75 us/op 0.99
set epochStatuses - ListTreeView 1.5092 ms/op 1.5242 ms/op 0.99
set epochStatuses - ListTreeView - set() 433.71 us/op 436.18 us/op 0.99
set epochStatuses - ListTreeView - commit() 404.14 us/op 506.07 us/op 0.80
bitstring 643.44 ns/op 642.62 ns/op 1.00
bit mask 13.821 ns/op 13.696 ns/op 1.01
struct - increase slot to 1000000 927.74 us/op 928.47 us/op 1.00
UintNumberType - increase slot to 1000000 28.502 ms/op 28.513 ms/op 1.00
UintBigintType - increase slot to 1000000 431.81 ms/op 419.66 ms/op 1.03
UintBigint8 x 100000 tree_deserialize 4.6817 ms/op 3.8782 ms/op 1.21
UintBigint8 x 100000 tree_serialize 1.2049 ms/op 1.1864 ms/op 1.02
UintBigint16 x 100000 tree_deserialize 4.2698 ms/op 3.6493 ms/op 1.17
UintBigint16 x 100000 tree_serialize 1.1933 ms/op 1.2084 ms/op 0.99
UintBigint32 x 100000 tree_deserialize 5.2578 ms/op 5.6076 ms/op 0.94
UintBigint32 x 100000 tree_serialize 1.2316 ms/op 1.2395 ms/op 0.99
UintBigint64 x 100000 tree_deserialize 5.6145 ms/op 5.6617 ms/op 0.99
UintBigint64 x 100000 tree_serialize 1.6008 ms/op 1.6213 ms/op 0.99
UintBigint8 x 100000 value_deserialize 435.22 us/op 433.18 us/op 1.00
UintBigint8 x 100000 value_serialize 613.45 us/op 584.56 us/op 1.05
UintBigint16 x 100000 value_deserialize 464.79 us/op 464.16 us/op 1.00
UintBigint16 x 100000 value_serialize 661.47 us/op 628.57 us/op 1.05
UintBigint32 x 100000 value_deserialize 433.03 us/op 433.76 us/op 1.00
UintBigint32 x 100000 value_serialize 645.41 us/op 632.24 us/op 1.02
UintBigint64 x 100000 value_deserialize 466.21 us/op 469.89 us/op 0.99
UintBigint64 x 100000 value_serialize 818.70 us/op 816.80 us/op 1.00
UintBigint8 x 100000 deserialize 4.7234 ms/op 4.5763 ms/op 1.03
UintBigint8 x 100000 serialize 1.5200 ms/op 1.3972 ms/op 1.09
UintBigint16 x 100000 deserialize 4.5077 ms/op 4.7741 ms/op 0.94
UintBigint16 x 100000 serialize 1.5154 ms/op 1.4327 ms/op 1.06
UintBigint32 x 100000 deserialize 5.3845 ms/op 5.5750 ms/op 0.97
UintBigint32 x 100000 serialize 2.7932 ms/op 2.8376 ms/op 0.98
UintBigint64 x 100000 deserialize 3.7204 ms/op 4.0938 ms/op 0.91
UintBigint64 x 100000 serialize 1.4708 ms/op 1.5023 ms/op 0.98
UintBigint128 x 100000 deserialize 5.7837 ms/op 5.9701 ms/op 0.97
UintBigint128 x 100000 serialize 16.755 ms/op 17.313 ms/op 0.97
UintBigint256 x 100000 deserialize 10.670 ms/op 11.522 ms/op 0.93
UintBigint256 x 100000 serialize 51.039 ms/op 50.078 ms/op 1.02
Slice from Uint8Array x25000 1.0002 ms/op 1.0017 ms/op 1.00
Slice from ArrayBuffer x25000 16.985 ms/op 18.313 ms/op 0.93
Slice from ArrayBuffer x25000 + new Uint8Array 17.493 ms/op 20.587 ms/op 0.85
Copy Uint8Array 100000 iterate 811.24 us/op 813.95 us/op 1.00
Copy Uint8Array 100000 slice 90.509 us/op 91.414 us/op 0.99
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 92.470 us/op 91.826 us/op 1.01
Copy Buffer 100000 Uint8Array.prototype.slice.call 90.442 us/op 91.816 us/op 0.99
Copy Uint8Array 100000 slice + set 150.00 us/op 180.89 us/op 0.83
Copy Uint8Array 100000 subarray + set 91.925 us/op 92.143 us/op 1.00
Copy Uint8Array 100000 slice arrayBuffer 90.627 us/op 93.190 us/op 0.97
Uint64 deserialize 100000 - iterate Uint8Array 1.7398 ms/op 1.8881 ms/op 0.92
Uint64 deserialize 100000 - by Uint32A 1.7135 ms/op 1.9112 ms/op 0.90
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.7395 ms/op 1.8924 ms/op 0.92
Uint64 deserialize 100000 - by DataView.getBigUint64 4.8152 ms/op 4.9778 ms/op 0.97
Uint64 deserialize 100000 - by byte 65.271 ms/op 65.340 ms/op 1.00

by benchmarkbot/action

@ensi321 ensi321 marked this pull request as ready for review April 4, 2024 15:32
@ensi321 ensi321 requested a review from a team as a code owner April 4, 2024 15:32
@ensi321 ensi321 changed the title add sliceFrom to ListCompositeTreeViewDU feat: add sliceFrom to ListCompositeTreeViewDU Apr 4, 2024
@ensi321 ensi321 mentioned this pull request Apr 4, 2024
31 tasks
Copy link
Contributor

@nazarhussain nazarhussain left a comment

Choose a reason for hiding this comment

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

Do we have some specs for this particular behavior? If yes please mention in the PR description.

packages/ssz/test/unit/byType/listComposite/tree.test.ts Outdated Show resolved Hide resolved
packages/ssz/src/viewDU/listComposite.ts Show resolved Hide resolved
packages/ssz/src/viewDU/listComposite.ts Show resolved Hide resolved
packages/ssz/test/unit/byType/listComposite/tree.test.ts Outdated Show resolved Hide resolved
@ensi321
Copy link
Contributor Author

ensi321 commented Apr 15, 2024

Do we have some specs for this particular behavior? If yes please mention in the PR description.

Updated. Thanks

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

For library usage, it would be nice to also include sliceFrom for ListBasicTreeViewDU

packages/ssz/src/viewDU/listComposite.ts Outdated Show resolved Hide resolved
packages/ssz/src/viewDU/listComposite.ts Show resolved Hide resolved
packages/ssz/src/viewDU/listComposite.ts Outdated Show resolved Hide resolved
packages/ssz/test/unit/byType/listComposite/tree.test.ts Outdated Show resolved Hide resolved
nazarhussain
nazarhussain previously approved these changes Apr 18, 2024
Copy link
Contributor

@nazarhussain nazarhussain left a comment

Choose a reason for hiding this comment

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

Other than @wemeetagain feedback LGTM.

ensi321 and others added 2 commits April 19, 2024 15:36
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

Looks good

@ensi321 ensi321 merged commit b3fa4f1 into master Apr 19, 2024
6 of 8 checks passed
@ensi321 ensi321 deleted the nc/slice-from branch April 19, 2024 15:53
@wemeetagain wemeetagain mentioned this pull request Apr 1, 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.

None yet

4 participants