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: ListCompositeTreeViewDU to getAllReadonly() without commit #456

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jan 21, 2025

Motivation
got Must commit changes before reading all nodes error in devnet-5 of electra ChainSafe/lodestar#7375

Description

  • getAllReadonly() without commit
    • we should be able to populate nodes array up until the old length
    • then get from the pending change, if not then get from the ViewDU of loaded this.nodes
  • getAllReadonlyValues() still need the commit change because we want the nodes of pending changes. So although the name is similar, it's different from getllReadonly()

Steps to test or reproduce

  • unit test was added

cc @nflaig @wemeetagain

@twoeths twoeths requested a review from a team as a code owner January 21, 2025 03:37
@github-actions github-actions bot added the ssz label Jan 21, 2025
Copy link

github-actions bot commented Jan 21, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 1a36176 Previous: eaa5422 Ratio
digestTwoHashObjects 50023 times 48.331 ms/op 48.343 ms/op 1.00
digest2Bytes32 50023 times 54.760 ms/op 54.914 ms/op 1.00
digest 50023 times 54.786 ms/op 54.120 ms/op 1.01
input length 32 1.1810 us/op 1.1790 us/op 1.00
input length 64 1.3450 us/op 1.3320 us/op 1.01
input length 128 2.2620 us/op 2.2620 us/op 1.00
input length 256 3.3850 us/op 3.3930 us/op 1.00
input length 512 5.5500 us/op 5.5310 us/op 1.00
input length 1024 10.656 us/op 10.738 us/op 0.99
digest 1000000 times 869.01 ms/op 862.63 ms/op 1.01
hashObjectToByteArray 50023 times 1.2311 ms/op 1.2296 ms/op 1.00
byteArrayToHashObject 50023 times 1.5484 ms/op 1.5556 ms/op 1.00
digest64 200092 times 213.92 ms/op 212.55 ms/op 1.01
hash 200092 times using batchHash4UintArray64s 238.37 ms/op 254.50 ms/op 0.94
digest64HashObjects 200092 times 192.76 ms/op 192.40 ms/op 1.00
hash 200092 times using batchHash4HashObjectInputs 202.55 ms/op 211.13 ms/op 0.96
getGindicesAtDepth 3.5970 us/op 3.6650 us/op 0.98
iterateAtDepth 6.4180 us/op 6.4020 us/op 1.00
getGindexBits 390.00 ns/op 393.00 ns/op 0.99
gindexIterator 881.00 ns/op 865.00 ns/op 1.02
HashComputationLevel.push then loop 26.757 ms/op 28.634 ms/op 0.93
HashComputation[] push then loop 48.654 ms/op 49.189 ms/op 0.99
hash 2 Uint8Array 500000 times - hashtree 221.93 ms/op 221.86 ms/op 1.00
hashTwoObjects 500000 times - hashtree 216.62 ms/op 210.17 ms/op 1.03
executeHashComputations - hashtree 9.8196 ms/op 9.7417 ms/op 1.01
hash 2 Uint8Array 500000 times - as-sha256 564.03 ms/op 559.74 ms/op 1.01
hashTwoObjects 500000 times - as-sha256 511.93 ms/op 509.62 ms/op 1.00
executeHashComputations - as-sha256 46.509 ms/op 47.231 ms/op 0.98
hash 2 Uint8Array 500000 times - noble 1.2443 s/op 1.2780 s/op 0.97
hashTwoObjects 500000 times - noble 1.7092 s/op 1.7553 s/op 0.97
executeHashComputations - noble 36.618 ms/op 37.065 ms/op 0.99
getHashComputations 2.6050 ms/op 2.2099 ms/op 1.18
executeHashComputations 9.5315 ms/op 12.175 ms/op 0.78
get root 15.695 ms/op 15.127 ms/op 1.04
getNodeH() x7812.5 avg hindex 12.276 us/op 12.232 us/op 1.00
getNodeH() x7812.5 index 0 7.5350 us/op 7.5140 us/op 1.00
getNodeH() x7812.5 index 7 7.5140 us/op 7.6380 us/op 0.98
getNodeH() x7812.5 index 7 with key array 6.3490 us/op 6.3410 us/op 1.00
new LeafNode() x7812.5 310.26 us/op 303.19 us/op 1.02
getHashComputations 250000 nodes 15.167 ms/op 15.022 ms/op 1.01
batchHash 250000 nodes 97.416 ms/op 89.300 ms/op 1.09
get root 250000 nodes 115.58 ms/op 118.05 ms/op 0.98
getHashComputations 500000 nodes 28.285 ms/op 30.704 ms/op 0.92
batchHash 500000 nodes 151.95 ms/op 169.24 ms/op 0.90
get root 500000 nodes 232.16 ms/op 227.96 ms/op 1.02
getHashComputations 1000000 nodes 63.952 ms/op 82.694 ms/op 0.77
batchHash 1000000 nodes 334.15 ms/op 325.52 ms/op 1.03
get root 1000000 nodes 469.33 ms/op 452.12 ms/op 1.04
multiproof - depth 15, 1 requested leaves 8.4580 us/op 8.5090 us/op 0.99
tree offset multiproof - depth 15, 1 requested leaves 18.040 us/op 19.038 us/op 0.95
compact multiproof - depth 15, 1 requested leaves 3.0120 us/op 3.4770 us/op 0.87
multiproof - depth 15, 2 requested leaves 11.501 us/op 12.443 us/op 0.92
tree offset multiproof - depth 15, 2 requested leaves 20.957 us/op 22.529 us/op 0.93
compact multiproof - depth 15, 2 requested leaves 3.0290 us/op 3.4040 us/op 0.89
multiproof - depth 15, 3 requested leaves 16.095 us/op 17.029 us/op 0.95
tree offset multiproof - depth 15, 3 requested leaves 27.583 us/op 29.964 us/op 0.92
compact multiproof - depth 15, 3 requested leaves 3.6670 us/op 4.4500 us/op 0.82
multiproof - depth 15, 4 requested leaves 21.898 us/op 24.254 us/op 0.90
tree offset multiproof - depth 15, 4 requested leaves 33.511 us/op 37.783 us/op 0.89
compact multiproof - depth 15, 4 requested leaves 4.7710 us/op 5.7080 us/op 0.84
packedRootsBytesToLeafNodes bytes 4000 offset 0 5.6860 us/op 6.1050 us/op 0.93
packedRootsBytesToLeafNodes bytes 4000 offset 1 5.7350 us/op 6.0280 us/op 0.95
packedRootsBytesToLeafNodes bytes 4000 offset 2 5.6980 us/op 6.1250 us/op 0.93
packedRootsBytesToLeafNodes bytes 4000 offset 3 5.6370 us/op 6.1070 us/op 0.92
subtreeFillToContents depth 40 count 250000 51.013 ms/op 51.410 ms/op 0.99
setRoot - gindexBitstring 24.617 ms/op 20.932 ms/op 1.18
setRoot - gindex 25.607 ms/op 23.149 ms/op 1.11
getRoot - gindexBitstring 2.8186 ms/op 2.6752 ms/op 1.05
getRoot - gindex 3.4415 ms/op 3.3844 ms/op 1.02
getHashObject then setHashObject 24.616 ms/op 22.727 ms/op 1.08
setNodeWithFn 20.030 ms/op 19.987 ms/op 1.00
getNodeAtDepth depth 0 x100000 280.98 us/op 280.64 us/op 1.00
setNodeAtDepth depth 0 x100000 2.5861 ms/op 2.4411 ms/op 1.06
getNodesAtDepth depth 0 x100000 312.85 us/op 312.27 us/op 1.00
setNodesAtDepth depth 0 x100000 761.71 us/op 778.15 us/op 0.98
getNodeAtDepth depth 1 x100000 342.13 us/op 345.62 us/op 0.99
setNodeAtDepth depth 1 x100000 8.5736 ms/op 8.0690 ms/op 1.06
getNodesAtDepth depth 1 x100000 437.73 us/op 436.37 us/op 1.00
setNodesAtDepth depth 1 x100000 7.3951 ms/op 7.7418 ms/op 0.96
getNodeAtDepth depth 2 x100000 737.02 us/op 827.14 us/op 0.89
setNodeAtDepth depth 2 x100000 16.634 ms/op 15.321 ms/op 1.09
getNodesAtDepth depth 2 x100000 17.630 ms/op 18.648 ms/op 0.95
setNodesAtDepth depth 2 x100000 24.157 ms/op 23.504 ms/op 1.03
tree.getNodesAtDepth - gindexes 8.3911 ms/op 9.6244 ms/op 0.87
tree.getNodesAtDepth - push all nodes 2.3290 ms/op 2.2478 ms/op 1.04
tree.getNodesAtDepth - navigation 312.50 us/op 311.51 us/op 1.00
tree.setNodesAtDepth - indexes 685.62 us/op 694.32 us/op 0.99
set at depth 8 872.00 ns/op 800.00 ns/op 1.09
set at depth 16 1.3220 us/op 1.1490 us/op 1.15
set at depth 32 2.3090 us/op 1.9830 us/op 1.16
iterateNodesAtDepth 8 256 13.920 us/op 14.046 us/op 0.99
getNodesAtDepth 8 256 3.7580 us/op 3.8560 us/op 0.97
iterateNodesAtDepth 16 65536 4.8094 ms/op 4.6197 ms/op 1.04
getNodesAtDepth 16 65536 2.0451 ms/op 1.8490 ms/op 1.11
iterateNodesAtDepth 32 250000 16.166 ms/op 16.809 ms/op 0.96
getNodesAtDepth 32 250000 4.9160 ms/op 5.0933 ms/op 0.97
iterateNodesAtDepth 40 250000 16.514 ms/op 17.423 ms/op 0.95
getNodesAtDepth 40 250000 6.8057 ms/op 5.1665 ms/op 1.32
250000 validators root getter 116.21 ms/op 114.66 ms/op 1.01
250000 validators batchHash() 84.694 ms/op 109.43 ms/op 0.77
250000 validators hashComputations 13.759 ms/op 20.603 ms/op 0.67
bitlist bytes to struct (120,90) 948.00 ns/op 725.00 ns/op 1.31
bitlist bytes to tree (120,90) 3.5930 us/op 2.9320 us/op 1.23
bitlist bytes to struct (2048,2048) 1.0560 us/op 987.00 ns/op 1.07
bitlist bytes to tree (2048,2048) 4.4630 us/op 3.9720 us/op 1.12
ByteListType - deserialize 8.4187 ms/op 7.4961 ms/op 1.12
BasicListType - deserialize 17.094 ms/op 13.922 ms/op 1.23
ByteListType - serialize 8.2564 ms/op 7.6725 ms/op 1.08
BasicListType - serialize 10.846 ms/op 9.8892 ms/op 1.10
BasicListType - tree_convertToStruct 29.584 ms/op 25.444 ms/op 1.16
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.0693 ms/op 4.5609 ms/op 1.11
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.2564 ms/op 4.2541 ms/op 1.00
Array.push len 300000 empty Array - number 6.9213 ms/op 6.9765 ms/op 0.99
Array.set len 300000 from new Array - number 2.2664 ms/op 1.6915 ms/op 1.34
Array.set len 300000 - number 5.5874 ms/op 5.9742 ms/op 0.94
Uint8Array.set len 300000 488.74 us/op 492.35 us/op 0.99
Uint32Array.set len 300000 558.06 us/op 570.54 us/op 0.98
Container({a: uint8, b: uint8}) getViewDU x300000 25.555 ms/op 25.408 ms/op 1.01
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 10.607 ms/op 10.677 ms/op 0.99
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 202.03 ms/op 214.62 ms/op 0.94
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 237.78 ms/op 268.49 ms/op 0.89
List(Container) len 300000 ViewDU.get(i) 6.6928 ms/op 6.8154 ms/op 0.98
List(Container) len 300000 ViewDU.getReadonly(i) 6.6478 ms/op 6.6002 ms/op 1.01
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 38.441 ms/op 37.503 ms/op 1.03
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.1602 ms/op 5.4542 ms/op 0.95
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.0818 ms/op 6.3123 ms/op 0.96
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.0974 ms/op 6.2646 ms/op 0.97
Array.push len 300000 empty Array - object 6.4843 ms/op 6.8085 ms/op 0.95
Array.set len 300000 from new Array - object 2.2698 ms/op 2.0685 ms/op 1.10
Array.set len 300000 - object 6.2308 ms/op 6.5557 ms/op 0.95
cachePermanentRootStruct no cache 5.1830 us/op 5.5030 us/op 0.94
cachePermanentRootStruct with cache 198.00 ns/op 233.00 ns/op 0.85
epochParticipation len 250000 rws 7813 2.3098 ms/op 2.2787 ms/op 1.01
BeaconState ViewDU hashTreeRoot() vc=200000 115.93 ms/op 114.70 ms/op 1.01
BeaconState ViewDU recursive hash - commit step vc=200000 4.5355 ms/op 5.1081 ms/op 0.89
BeaconState ViewDU validator tree creation vc=10000 41.004 ms/op 39.330 ms/op 1.04
BeaconState ViewDU batchHashTreeRoot vc=200000 108.95 ms/op 106.72 ms/op 1.02
BeaconState ViewDU hashTreeRoot - commit step vc=200000 98.117 ms/op 92.361 ms/op 1.06
BeaconState ViewDU hashTreeRoot - hash step vc=200000 17.979 ms/op 17.984 ms/op 1.00
deserialize Attestation - tree 3.8990 us/op 3.6790 us/op 1.06
deserialize Attestation - struct 2.1350 us/op 1.9310 us/op 1.11
deserialize SignedAggregateAndProof - tree 5.4110 us/op 4.7860 us/op 1.13
deserialize SignedAggregateAndProof - struct 3.5630 us/op 3.1420 us/op 1.13
deserialize SyncCommitteeMessage - tree 1.5730 us/op 1.3860 us/op 1.13
deserialize SyncCommitteeMessage - struct 1.0940 us/op 1.0270 us/op 1.07
deserialize SignedContributionAndProof - tree 3.2690 us/op 3.0010 us/op 1.09
deserialize SignedContributionAndProof - struct 2.7140 us/op 2.5110 us/op 1.08
deserialize SignedBeaconBlock - tree 318.75 us/op 277.30 us/op 1.15
deserialize SignedBeaconBlock - struct 143.17 us/op 122.23 us/op 1.17
BeaconState vc 300000 - deserialize tree 694.35 ms/op 676.34 ms/op 1.03
BeaconState vc 300000 - serialize tree 163.20 ms/op 167.42 ms/op 0.97
BeaconState.historicalRoots vc 300000 - deserialize tree 963.00 ns/op 862.00 ns/op 1.12
BeaconState.historicalRoots vc 300000 - serialize tree 762.00 ns/op 704.00 ns/op 1.08
BeaconState.validators vc 300000 - deserialize tree 635.88 ms/op 624.22 ms/op 1.02
BeaconState.validators vc 300000 - serialize tree 112.80 ms/op 117.23 ms/op 0.96
BeaconState.balances vc 300000 - deserialize tree 30.031 ms/op 25.712 ms/op 1.17
BeaconState.balances vc 300000 - serialize tree 3.6044 ms/op 4.8865 ms/op 0.74
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 860.70 us/op 1.2270 ms/op 0.70
BeaconState.previousEpochParticipation vc 300000 - serialize tree 327.32 us/op 340.18 us/op 0.96
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 873.33 us/op 1.2029 ms/op 0.73
BeaconState.currentEpochParticipation vc 300000 - serialize tree 326.02 us/op 343.08 us/op 0.95
BeaconState.inactivityScores vc 300000 - deserialize tree 26.132 ms/op 28.260 ms/op 0.92
BeaconState.inactivityScores vc 300000 - serialize tree 3.3973 ms/op 5.1677 ms/op 0.66
hashTreeRoot Attestation - struct 18.949 us/op 22.592 us/op 0.84
hashTreeRoot Attestation - tree 9.6740 us/op 9.3680 us/op 1.03
hashTreeRoot SignedAggregateAndProof - struct 23.245 us/op 26.281 us/op 0.88
hashTreeRoot SignedAggregateAndProof - tree 14.440 us/op 13.997 us/op 1.03
hashTreeRoot SyncCommitteeMessage - struct 6.0300 us/op 6.8460 us/op 0.88
hashTreeRoot SyncCommitteeMessage - tree 3.7250 us/op 3.9930 us/op 0.93
hashTreeRoot SignedContributionAndProof - struct 14.133 us/op 16.280 us/op 0.87
hashTreeRoot SignedContributionAndProof - tree 9.9190 us/op 9.5780 us/op 1.04
hashTreeRoot SignedBeaconBlock - struct 1.2249 ms/op 1.3779 ms/op 0.89
hashTreeRoot SignedBeaconBlock - tree 856.58 us/op 853.85 us/op 1.00
hashTreeRoot Validator - struct 7.4840 us/op 9.2120 us/op 0.81
hashTreeRoot Validator - tree 7.2360 us/op 7.9510 us/op 0.91
BeaconState vc 300000 - hashTreeRoot tree 2.2829 s/op 2.3690 s/op 0.96
BeaconState vc 300000 - batchHashTreeRoot tree 4.2226 s/op 4.3481 s/op 0.97
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.0790 us/op 1.1480 us/op 0.94
BeaconState.validators vc 300000 - hashTreeRoot tree 2.5130 s/op 2.6108 s/op 0.96
BeaconState.balances vc 300000 - hashTreeRoot tree 37.448 ms/op 36.774 ms/op 1.02
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 4.5280 ms/op 4.5261 ms/op 1.00
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 4.5616 ms/op 4.4370 ms/op 1.03
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 40.178 ms/op 36.127 ms/op 1.11
hash64 x18 9.0270 us/op 9.2710 us/op 0.97
hashTwoObjects x18 8.7860 us/op 8.4270 us/op 1.04
hash64 x1740 817.12 us/op 842.59 us/op 0.97
hashTwoObjects x1740 813.82 us/op 782.48 us/op 1.04
hash64 x2700000 1.2458 s/op 1.3137 s/op 0.95
hashTwoObjects x2700000 1.2784 s/op 1.2167 s/op 1.05
get_exitEpoch - ContainerType 407.00 ns/op 272.00 ns/op 1.50
get_exitEpoch - ContainerNodeStructType 405.00 ns/op 297.00 ns/op 1.36
set_exitEpoch - ContainerType 418.00 ns/op 285.00 ns/op 1.47
set_exitEpoch - ContainerNodeStructType 411.00 ns/op 294.00 ns/op 1.40
get_pubkey - ContainerType 1.3900 us/op 1.1750 us/op 1.18
get_pubkey - ContainerNodeStructType 405.00 ns/op 320.00 ns/op 1.27
hashTreeRoot - ContainerType 709.00 ns/op 548.00 ns/op 1.29
hashTreeRoot - ContainerNodeStructType 663.00 ns/op 491.00 ns/op 1.35
createProof - ContainerType 7.0560 us/op 4.6070 us/op 1.53
createProof - ContainerNodeStructType 33.205 us/op 24.738 us/op 1.34
serialize - ContainerType 2.1050 us/op 1.8810 us/op 1.12
serialize - ContainerNodeStructType 1.9040 us/op 1.6330 us/op 1.17
set_exitEpoch_and_hashTreeRoot - ContainerType 4.0600 us/op 3.1980 us/op 1.27
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 10.450 us/op 8.4070 us/op 1.24
Array - for of 6.0460 us/op 5.8240 us/op 1.04
Array - for(;;) 5.9300 us/op 5.6630 us/op 1.05
basicListValue.readonlyValuesArray() 5.6815 ms/op 5.7234 ms/op 0.99
basicListValue.readonlyValuesArray() + loop all 5.2293 ms/op 5.8158 ms/op 0.90
compositeListValue.readonlyValuesArray() 32.665 ms/op 29.962 ms/op 1.09
compositeListValue.readonlyValuesArray() + loop all 31.945 ms/op 32.100 ms/op 1.00
Number64UintType - get balances list 4.3415 ms/op 4.7705 ms/op 0.91
Number64UintType - set balances list 10.027 ms/op 10.118 ms/op 0.99
Number64UintType - get and increase 10 then set 40.653 ms/op 43.958 ms/op 0.92
Number64UintType - increase 10 using applyDelta 15.691 ms/op 17.426 ms/op 0.90
Number64UintType - increase 10 using applyDeltaInBatch 16.380 ms/op 17.727 ms/op 0.92
tree_newTreeFromUint64Deltas 23.230 ms/op 22.925 ms/op 1.01
unsafeUint8ArrayToTree 35.697 ms/op 42.145 ms/op 0.85
bitLength(50) 221.00 ns/op 273.00 ns/op 0.81
bitLengthStr(50) 225.00 ns/op 250.00 ns/op 0.90
bitLength(8000) 211.00 ns/op 275.00 ns/op 0.77
bitLengthStr(8000) 264.00 ns/op 285.00 ns/op 0.93
bitLength(250000) 212.00 ns/op 272.00 ns/op 0.78
bitLengthStr(250000) 291.00 ns/op 313.00 ns/op 0.93
floor - Math.floor (53) 1.2435 ns/op 1.2431 ns/op 1.00
floor - << 0 (53) 1.2434 ns/op 1.2434 ns/op 1.00
floor - Math.floor (512) 1.2459 ns/op 1.2434 ns/op 1.00
floor - << 0 (512) 1.2436 ns/op 1.2440 ns/op 1.00
fnIf(0) 1.5541 ns/op 1.5569 ns/op 1.00
fnSwitch(0) 2.1812 ns/op 2.1830 ns/op 1.00
fnObj(0) 1.5564 ns/op 1.5563 ns/op 1.00
fnArr(0) 1.5555 ns/op 1.5568 ns/op 1.00
fnIf(4) 2.1767 ns/op 2.1751 ns/op 1.00
fnSwitch(4) 2.1992 ns/op 2.2175 ns/op 0.99
fnObj(4) 1.5560 ns/op 1.5545 ns/op 1.00
fnArr(4) 1.5538 ns/op 1.5613 ns/op 1.00
fnIf(9) 3.1075 ns/op 3.1100 ns/op 1.00
fnSwitch(9) 2.1766 ns/op 2.1766 ns/op 1.00
fnObj(9) 1.5598 ns/op 1.5570 ns/op 1.00
fnArr(9) 1.5559 ns/op 1.5640 ns/op 0.99
Container {a,b,vec} - as struct x100000 126.51 us/op 124.64 us/op 1.02
Container {a,b,vec} - as tree x100000 529.15 us/op 874.52 us/op 0.61
Container {a,vec,b} - as struct x100000 155.61 us/op 155.72 us/op 1.00
Container {a,vec,b} - as tree x100000 497.82 us/op 497.77 us/op 1.00
get 2 props x1000000 - rawObject 311.79 us/op 312.16 us/op 1.00
get 2 props x1000000 - proxy 73.298 ms/op 74.313 ms/op 0.99
get 2 props x1000000 - customObj 311.78 us/op 312.21 us/op 1.00
Simple object binary -> struct 549.00 ns/op 599.00 ns/op 0.92
Simple object binary -> tree_backed 1.5740 us/op 1.7140 us/op 0.92
Simple object struct -> tree_backed 2.0860 us/op 2.2600 us/op 0.92
Simple object tree_backed -> struct 1.4830 us/op 1.6100 us/op 0.92
Simple object struct -> binary 793.00 ns/op 810.00 ns/op 0.98
Simple object tree_backed -> binary 1.2400 us/op 1.3430 us/op 0.92
aggregationBits binary -> struct 460.00 ns/op 515.00 ns/op 0.89
aggregationBits binary -> tree_backed 2.0190 us/op 2.3020 us/op 0.88
aggregationBits struct -> tree_backed 2.3150 us/op 2.6650 us/op 0.87
aggregationBits tree_backed -> struct 884.00 ns/op 1.0550 us/op 0.84
aggregationBits struct -> binary 693.00 ns/op 806.00 ns/op 0.86
aggregationBits tree_backed -> binary 790.00 ns/op 895.00 ns/op 0.88
List(uint8) 100000 binary -> struct 1.6202 ms/op 1.7281 ms/op 0.94
List(uint8) 100000 binary -> tree_backed 263.68 us/op 304.78 us/op 0.87
List(uint8) 100000 struct -> tree_backed 1.3790 ms/op 1.4790 ms/op 0.93
List(uint8) 100000 tree_backed -> struct 1.1980 ms/op 1.1232 ms/op 1.07
List(uint8) 100000 struct -> binary 1.1094 ms/op 1.1776 ms/op 0.94
List(uint8) 100000 tree_backed -> binary 107.28 us/op 107.99 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.3709 ms/op 1.4030 ms/op 0.98
List(uint64Number) 100000 binary -> tree_backed 4.4833 ms/op 5.1278 ms/op 0.87
List(uint64Number) 100000 struct -> tree_backed 6.6961 ms/op 7.3909 ms/op 0.91
List(uint64Number) 100000 tree_backed -> struct 2.5303 ms/op 2.4528 ms/op 1.03
List(uint64Number) 100000 struct -> binary 1.5712 ms/op 1.6313 ms/op 0.96
List(uint64Number) 100000 tree_backed -> binary 1.0322 ms/op 1.0190 ms/op 1.01
List(Uint64Bigint) 100000 binary -> struct 4.0269 ms/op 4.0184 ms/op 1.00
List(Uint64Bigint) 100000 binary -> tree_backed 5.2803 ms/op 5.6445 ms/op 0.94
List(Uint64Bigint) 100000 struct -> tree_backed 6.6601 ms/op 7.3050 ms/op 0.91
List(Uint64Bigint) 100000 tree_backed -> struct 4.7565 ms/op 5.2533 ms/op 0.91
List(Uint64Bigint) 100000 struct -> binary 2.0742 ms/op 2.1829 ms/op 0.95
List(Uint64Bigint) 100000 tree_backed -> binary 1.0910 ms/op 1.0390 ms/op 1.05
Vector(Root) 100000 binary -> struct 36.775 ms/op 34.990 ms/op 1.05
Vector(Root) 100000 binary -> tree_backed 40.271 ms/op 39.097 ms/op 1.03
Vector(Root) 100000 struct -> tree_backed 50.188 ms/op 55.210 ms/op 0.91
Vector(Root) 100000 tree_backed -> struct 49.904 ms/op 53.862 ms/op 0.93
Vector(Root) 100000 struct -> binary 2.8376 ms/op 3.1628 ms/op 0.90
Vector(Root) 100000 tree_backed -> binary 6.2782 ms/op 6.0080 ms/op 1.04
List(Validator) 100000 binary -> struct 100.71 ms/op 105.99 ms/op 0.95
List(Validator) 100000 binary -> tree_backed 335.18 ms/op 382.12 ms/op 0.88
List(Validator) 100000 struct -> tree_backed 374.28 ms/op 399.87 ms/op 0.94
List(Validator) 100000 tree_backed -> struct 212.24 ms/op 229.28 ms/op 0.93
List(Validator) 100000 struct -> binary 32.716 ms/op 29.617 ms/op 1.10
List(Validator) 100000 tree_backed -> binary 113.38 ms/op 113.17 ms/op 1.00
List(Validator-NS) 100000 binary -> struct 109.60 ms/op 107.63 ms/op 1.02
List(Validator-NS) 100000 binary -> tree_backed 137.89 ms/op 165.90 ms/op 0.83
List(Validator-NS) 100000 struct -> tree_backed 207.11 ms/op 210.08 ms/op 0.99
List(Validator-NS) 100000 tree_backed -> struct 172.50 ms/op 176.02 ms/op 0.98
List(Validator-NS) 100000 struct -> binary 32.376 ms/op 30.296 ms/op 1.07
List(Validator-NS) 100000 tree_backed -> binary 33.881 ms/op 36.050 ms/op 0.94
get epochStatuses - MutableVector 94.990 us/op 103.06 us/op 0.92
get epochStatuses - ViewDU 208.64 us/op 206.51 us/op 1.01
set epochStatuses - ListTreeView 2.1049 ms/op 2.1855 ms/op 0.96
set epochStatuses - ListTreeView - set() 467.58 us/op 466.67 us/op 1.00
set epochStatuses - ListTreeView - commit() 801.94 us/op 767.17 us/op 1.05
bitstring 514.25 ns/op 515.30 ns/op 1.00
bit mask 13.289 ns/op 13.625 ns/op 0.98
struct - increase slot to 1000000 932.81 us/op 947.66 us/op 0.98
UintNumberType - increase slot to 1000000 27.411 ms/op 27.417 ms/op 1.00
UintBigintType - increase slot to 1000000 169.07 ms/op 181.83 ms/op 0.93
UintBigint8 x 100000 tree_deserialize 5.5883 ms/op 5.6680 ms/op 0.99
UintBigint8 x 100000 tree_serialize 1.1257 ms/op 1.0976 ms/op 1.03
UintBigint16 x 100000 tree_deserialize 5.3243 ms/op 5.2594 ms/op 1.01
UintBigint16 x 100000 tree_serialize 1.3288 ms/op 1.3018 ms/op 1.02
UintBigint32 x 100000 tree_deserialize 5.5541 ms/op 5.4588 ms/op 1.02
UintBigint32 x 100000 tree_serialize 1.8622 ms/op 1.8521 ms/op 1.01
UintBigint64 x 100000 tree_deserialize 5.9941 ms/op 6.1015 ms/op 0.98
UintBigint64 x 100000 tree_serialize 2.5280 ms/op 2.5449 ms/op 0.99
UintBigint8 x 100000 value_deserialize 439.57 us/op 435.90 us/op 1.01
UintBigint8 x 100000 value_serialize 795.06 us/op 766.67 us/op 1.04
UintBigint16 x 100000 value_deserialize 467.29 us/op 466.55 us/op 1.00
UintBigint16 x 100000 value_serialize 828.79 us/op 814.29 us/op 1.02
UintBigint32 x 100000 value_deserialize 498.35 us/op 497.94 us/op 1.00
UintBigint32 x 100000 value_serialize 882.59 us/op 861.73 us/op 1.02
UintBigint64 x 100000 value_deserialize 562.20 us/op 563.65 us/op 1.00
UintBigint64 x 100000 value_serialize 1.0658 ms/op 1.0761 ms/op 0.99
UintBigint8 x 100000 deserialize 3.1659 ms/op 3.6217 ms/op 0.87
UintBigint8 x 100000 serialize 1.6953 ms/op 1.5562 ms/op 1.09
UintBigint16 x 100000 deserialize 3.1969 ms/op 3.7344 ms/op 0.86
UintBigint16 x 100000 serialize 1.7065 ms/op 1.5360 ms/op 1.11
UintBigint32 x 100000 deserialize 3.5268 ms/op 3.5466 ms/op 0.99
UintBigint32 x 100000 serialize 2.9628 ms/op 3.7325 ms/op 0.79
UintBigint64 x 100000 deserialize 3.8819 ms/op 4.4354 ms/op 0.88
UintBigint64 x 100000 serialize 1.6445 ms/op 1.6573 ms/op 0.99
UintBigint128 x 100000 deserialize 5.2447 ms/op 5.8991 ms/op 0.89
UintBigint128 x 100000 serialize 14.787 ms/op 15.735 ms/op 0.94
UintBigint256 x 100000 deserialize 8.4059 ms/op 9.4986 ms/op 0.88
UintBigint256 x 100000 serialize 44.237 ms/op 44.685 ms/op 0.99
Slice from Uint8Array x25000 1.3570 ms/op 1.4345 ms/op 0.95
Slice from ArrayBuffer x25000 16.569 ms/op 17.134 ms/op 0.97
Slice from ArrayBuffer x25000 + new Uint8Array 17.317 ms/op 18.761 ms/op 0.92
Copy Uint8Array 100000 iterate 2.6741 ms/op 2.7570 ms/op 0.97
Copy Uint8Array 100000 slice 111.77 us/op 107.51 us/op 1.04
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 116.10 us/op 109.64 us/op 1.06
Copy Buffer 100000 Uint8Array.prototype.slice.call 115.69 us/op 108.55 us/op 1.07
Copy Uint8Array 100000 slice + set 235.77 us/op 218.44 us/op 1.08
Copy Uint8Array 100000 subarray + set 121.08 us/op 108.58 us/op 1.12
Copy Uint8Array 100000 slice arrayBuffer 132.65 us/op 108.83 us/op 1.22
Uint64 deserialize 100000 - iterate Uint8Array 2.1774 ms/op 2.0431 ms/op 1.07
Uint64 deserialize 100000 - by Uint32A 2.0578 ms/op 2.0785 ms/op 0.99
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.9982 ms/op 1.8679 ms/op 1.07
Uint64 deserialize 100000 - by DataView.getBigUint64 5.2009 ms/op 5.0165 ms/op 1.04
Uint64 deserialize 100000 - by byte 40.694 ms/op 40.742 ms/op 1.00

by benchmarkbot/action

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

This seems like the cleanest solution to the issue we have

@wemeetagain wemeetagain merged commit 94510c9 into master Jan 27, 2025
8 checks passed
@wemeetagain wemeetagain deleted the te/getAllReadonly branch January 27, 2025 15:41
wemeetagain pushed a commit to ChainSafe/lodestar that referenced this pull request Feb 3, 2025
…tation (#7419)

Since ChainSafe/ssz#456 it's possible to use
`getAllReadonly()` with uncommited changes. This PR essential reverts
changes done in #7375 as it
causes more memory allocation which is not ideal.
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