Skip to content

fix: check first offset in readVariableOffsetsArrayComposite - #543

Merged
wemeetagain merged 1 commit into
masterfrom
te/fix_readVariableOffsetsArrayComposite
Aug 17, 2026
Merged

fix: check first offset in readVariableOffsetsArrayComposite#543
wemeetagain merged 1 commit into
masterfrom
te/fix_readVariableOffsetsArrayComposite

Conversation

@twoeths

@twoeths twoeths commented Aug 14, 2026

Copy link
Copy Markdown
Member

Motivation

  • we don't want to allocate too much memory if someone feed an invalid first offset in array composite ssz bytes

Description

  • bound check it against the size for 1st offset
  • we already check it from the 2nd offset

@twoeths
twoeths requested a review from a team as a code owner August 14, 2026 10:55
@github-actions github-actions Bot added the ssz label Aug 14, 2026
@twoeths
twoeths force-pushed the te/fix_readVariableOffsetsArrayComposite branch from a853019 to 134dcba Compare August 14, 2026 10:56
@github-actions

Copy link
Copy Markdown
Contributor

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 96060f1 Previous: a2d3d65 Ratio
hash 200092 times using batchHash4HashObjectInputs 47.405 ms/op 147.43 ms/op 0.32
batch hash 16 x 64 Uint8Array 31250 times - as-sha256 116.46 ms/op 381.48 ms/op 0.31
cachePermanentRootStruct with cache 90.000 ns/op 452.00 ns/op 0.20
Container {a,b,vec} - as tree x100000 372.15 us/op 1.2152 ms/op 0.31
Container {a,vec,b} - as tree x100000 384.05 us/op 1.2145 ms/op 0.32
UintBigint16 x 100000 serialize 915.71 us/op 3.1908 ms/op 0.29
Full benchmark results
Benchmark suite Current: 96060f1 Previous: a2d3d65 Ratio
digestTwoHashObjects 50023 times 22.680 ms/op 38.571 ms/op 0.59
digest2Bytes32 50023 times 25.180 ms/op 42.428 ms/op 0.59
digest 50023 times 24.640 ms/op 41.750 ms/op 0.59
input length 32 526.00 ns/op 919.00 ns/op 0.57
input length 64 615.00 ns/op 1.0420 us/op 0.59
input length 128 1.0880 us/op 1.7750 us/op 0.61
input length 256 1.6310 us/op 2.6250 us/op 0.62
input length 512 2.8660 us/op 4.3670 us/op 0.66
input length 1024 5.1480 us/op 8.4410 us/op 0.61
digest 1000000 times 398.06 ms/op 648.81 ms/op 0.61
hashObjectToByteArray 50023 times 677.05 us/op 980.66 us/op 0.69
byteArrayToHashObject 50023 times 860.11 us/op 1.0874 ms/op 0.79
digest64 200092 times 103.92 ms/op 166.05 ms/op 0.63
hash 200092 times using batchHash4UintArray64s 60.441 ms/op 174.57 ms/op 0.35
digest64HashObjects 200092 times 90.718 ms/op 155.13 ms/op 0.58
hash 200092 times using batchHash4HashObjectInputs 47.405 ms/op 147.43 ms/op 0.32
getGindicesAtDepth 1.9860 us/op 3.1580 us/op 0.63
iterateAtDepth 3.6160 us/op 5.8970 us/op 0.61
getGindexBits 199.00 ns/op 354.00 ns/op 0.56
gindexIterator 503.00 ns/op 779.00 ns/op 0.65
HashComputationLevel.push then loop 25.143 ms/op 27.736 ms/op 0.91
HashComputation[] push then loop 47.817 ms/op 41.548 ms/op 1.15
hash 2 32 bytes Uint8Array 500000 times - hashtree 89.302 ms/op 146.18 ms/op 0.61
batch hash 16 x 64 Uint8Array 31250 times - hashtree 26.204 ms/op 24.648 ms/op 1.06
hashTwoObjects 500000 times - hashtree 105.61 ms/op 167.32 ms/op 0.63
executeHashComputations - hashtree 6.3972 ms/op 8.4536 ms/op 0.76
hash 2 32 bytes Uint8Array 500000 times - as-sha256 237.98 ms/op 393.51 ms/op 0.60
batch hash 16 x 64 Uint8Array 31250 times - as-sha256 116.46 ms/op 381.48 ms/op 0.31
hashTwoObjects 500000 times - as-sha256 236.05 ms/op 405.29 ms/op 0.58
executeHashComputations - as-sha256 11.638 ms/op 32.205 ms/op 0.36
hash 2 32 bytes Uint8Array 500000 times - noble 723.03 ms/op 1.0548 s/op 0.69
batch hash 16 x 64 Uint8Array 31250 times - noble 726.66 ms/op 1.0283 s/op 0.71
hashTwoObjects 500000 times - noble 1.3396 s/op 1.6681 s/op 0.80
executeHashComputations - noble 18.548 ms/op 31.309 ms/op 0.59
getHashComputations 1.4478 ms/op 2.2850 ms/op 0.63
executeHashComputations 6.9306 ms/op 7.7961 ms/op 0.89
get root 8.2373 ms/op 13.819 ms/op 0.60
getNodeH() x7812.5 avg hindex 9.8840 us/op 12.670 us/op 0.78
getNodeH() x7812.5 index 0 3.1510 us/op 4.6880 us/op 0.67
getNodeH() x7812.5 index 7 3.1460 us/op 4.6830 us/op 0.67
getNodeH() x7812.5 index 7 with key array 3.1450 us/op 4.6820 us/op 0.67
new LeafNode() x7812.5 163.72 us/op 259.29 us/op 0.63
getHashComputations 250000 nodes 7.4853 ms/op 10.250 ms/op 0.73
batchHash 250000 nodes 50.330 ms/op 66.148 ms/op 0.76
get root 250000 nodes 59.984 ms/op 96.122 ms/op 0.62
getHashComputations 500000 nodes 15.119 ms/op 20.219 ms/op 0.75
batchHash 500000 nodes 125.76 ms/op 155.64 ms/op 0.81
get root 500000 nodes 129.73 ms/op 190.17 ms/op 0.68
getHashComputations 1000000 nodes 28.656 ms/op 40.751 ms/op 0.70
batchHash 1000000 nodes 227.71 ms/op 264.30 ms/op 0.86
get root 1000000 nodes 236.19 ms/op 380.08 ms/op 0.62
multiproof - depth 15, 1 requested leaves 4.3530 us/op 6.4240 us/op 0.68
tree offset multiproof - depth 15, 1 requested leaves 9.7700 us/op 15.704 us/op 0.62
compact multiproof - depth 15, 1 requested leaves 2.1290 us/op 2.3380 us/op 0.91
multiproof - depth 15, 2 requested leaves 6.6190 us/op 9.5530 us/op 0.69
tree offset multiproof - depth 15, 2 requested leaves 12.020 us/op 18.601 us/op 0.65
compact multiproof - depth 15, 2 requested leaves 2.0880 us/op 2.3600 us/op 0.88
multiproof - depth 15, 3 requested leaves 9.2770 us/op 13.720 us/op 0.68
tree offset multiproof - depth 15, 3 requested leaves 15.508 us/op 24.062 us/op 0.64
compact multiproof - depth 15, 3 requested leaves 2.3520 us/op 2.6610 us/op 0.88
multiproof - depth 15, 4 requested leaves 12.494 us/op 18.338 us/op 0.68
tree offset multiproof - depth 15, 4 requested leaves 19.218 us/op 29.613 us/op 0.65
compact multiproof - depth 15, 4 requested leaves 2.7950 us/op 3.1220 us/op 0.90
packedRootsBytesToLeafNodes bytes 4000 offset 0 3.0590 us/op 4.5910 us/op 0.67
packedRootsBytesToLeafNodes bytes 4000 offset 1 3.0250 us/op 4.6040 us/op 0.66
packedRootsBytesToLeafNodes bytes 4000 offset 2 3.0080 us/op 4.6010 us/op 0.65
packedRootsBytesToLeafNodes bytes 4000 offset 3 3.1040 us/op 4.6010 us/op 0.67
subtreeFillToContents depth 40 count 250000 12.142 ms/op 16.755 ms/op 0.72
setRoot - gindexBitstring 15.140 ms/op 18.953 ms/op 0.80
setRoot - gindex 12.955 ms/op 19.946 ms/op 0.65
getRoot - gindexBitstring 1.3938 ms/op 1.9699 ms/op 0.71
getRoot - gindex 1.7037 ms/op 2.5234 ms/op 0.68
getHashObject then setHashObject 15.527 ms/op 20.097 ms/op 0.77
setNodeWithFn 12.791 ms/op 18.041 ms/op 0.71
getNodeAtDepth depth 0 x100000 155.19 us/op 214.72 us/op 0.72
setNodeAtDepth depth 0 x100000 1.0925 ms/op 1.8373 ms/op 0.59
getNodesAtDepth depth 0 x100000 205.92 us/op 280.56 us/op 0.73
setNodesAtDepth depth 0 x100000 420.01 us/op 691.44 us/op 0.61
getNodeAtDepth depth 1 x100000 215.08 us/op 280.57 us/op 0.77
setNodeAtDepth depth 1 x100000 4.1321 ms/op 6.9002 ms/op 0.60
getNodesAtDepth depth 1 x100000 293.19 us/op 406.22 us/op 0.72
setNodesAtDepth depth 1 x100000 3.7357 ms/op 5.5627 ms/op 0.67
getNodeAtDepth depth 2 x100000 492.65 us/op 622.39 us/op 0.79
setNodeAtDepth depth 2 x100000 7.9939 ms/op 13.706 ms/op 0.58
getNodesAtDepth depth 2 x100000 8.9583 ms/op 18.397 ms/op 0.49
setNodesAtDepth depth 2 x100000 11.955 ms/op 19.683 ms/op 0.61
tree.getNodesAtDepth - gindexes 4.1084 ms/op 10.203 ms/op 0.40
tree.getNodesAtDepth - push all nodes 629.61 us/op 1.0550 ms/op 0.60
tree.getNodesAtDepth - navigation 119.42 us/op 154.35 us/op 0.77
tree.setNodesAtDepth - indexes 384.12 us/op 596.91 us/op 0.64
set at depth 8 402.00 ns/op 656.00 ns/op 0.61
set at depth 16 613.00 ns/op 954.00 ns/op 0.64
set at depth 32 1.0850 us/op 1.5950 us/op 0.68
iterateNodesAtDepth 8 256 8.3870 us/op 12.116 us/op 0.69
getNodesAtDepth 8 256 2.4000 us/op 3.1210 us/op 0.77
iterateNodesAtDepth 16 65536 2.6717 ms/op 3.7546 ms/op 0.71
getNodesAtDepth 16 65536 713.41 us/op 957.17 us/op 0.75
iterateNodesAtDepth 32 250000 10.165 ms/op 14.092 ms/op 0.72
getNodesAtDepth 32 250000 2.7067 ms/op 3.6073 ms/op 0.75
iterateNodesAtDepth 40 250000 10.156 ms/op 14.045 ms/op 0.72
getNodesAtDepth 40 250000 2.6804 ms/op 3.6265 ms/op 0.74
250000 validators root getter 59.882 ms/op 98.683 ms/op 0.61
250000 validators batchHash() 43.845 ms/op 68.863 ms/op 0.64
250000 validators hashComputations 4.8827 ms/op 12.776 ms/op 0.38
bitlist bytes to struct (120,90) 183.00 ns/op 362.00 ns/op 0.51
bitlist bytes to tree (120,90) 1.1620 us/op 1.7520 us/op 0.66
bitlist bytes to struct (2048,2048) 462.00 ns/op 692.00 ns/op 0.67
bitlist bytes to tree (2048,2048) 3.2490 us/op 2.9600 us/op 1.10
ByteListType - deserialize 7.3534 ms/op 6.7969 ms/op 1.08
BasicListType - deserialize 5.6732 ms/op 7.1811 ms/op 0.79
ByteListType - serialize 8.9146 ms/op 7.5392 ms/op 1.18
BasicListType - serialize 9.3323 ms/op 12.589 ms/op 0.74
BasicListType - tree_convertToStruct 14.583 ms/op 21.439 ms/op 0.68
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 2.3326 ms/op 4.2467 ms/op 0.55
List[uint8, 68719476736] len 300000 ViewDU.get(i) 1.9809 ms/op 3.6861 ms/op 0.54
Array.push len 300000 empty Array - number 2.7717 ms/op 4.0894 ms/op 0.68
Array.set len 300000 from new Array - number 764.65 us/op 1.1830 ms/op 0.65
Array.set len 300000 - number 2.8107 ms/op 4.2505 ms/op 0.66
Uint8Array.set len 300000 174.08 us/op 266.78 us/op 0.65
Uint32Array.set len 300000 398.21 us/op 764.95 us/op 0.52
Container({a: uint8, b: uint8}) getViewDU x300000 41.439 ms/op 36.154 ms/op 1.15
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 7.1006 ms/op 9.1507 ms/op 0.78
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 72.297 ms/op 90.075 ms/op 0.80
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 238.70 ms/op 271.55 ms/op 0.88
List(Container) len 300000 ViewDU.get(i) 8.2100 ms/op 9.1868 ms/op 0.89
List(Container) len 300000 ViewDU.getReadonly(i) 8.1674 ms/op 10.007 ms/op 0.82
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 11.680 ms/op 15.168 ms/op 0.77
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 2.0476 ms/op 3.9382 ms/op 0.52
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 7.8576 ms/op 7.4088 ms/op 1.06
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 7.8233 ms/op 7.4852 ms/op 1.05
Array.push len 300000 empty Array - object 2.8721 ms/op 4.2544 ms/op 0.68
Array.set len 300000 from new Array - object 777.88 us/op 1.2357 ms/op 0.63
Array.set len 300000 - object 2.9907 ms/op 4.3160 ms/op 0.69
cachePermanentRootStruct no cache 1.5790 us/op 2.6030 us/op 0.61
cachePermanentRootStruct with cache 90.000 ns/op 452.00 ns/op 0.20
epochParticipation len 250000 rws 7813 1.7213 ms/op 2.5801 ms/op 0.67
Deneb BeaconBlock.hashTreeRoot(), numTransaction=200 2.7434 ms/op 4.1860 ms/op 0.66
BeaconState ViewDU batchHashTreeRoot vc=200000 mod=100000 165.42 ms/op 212.68 ms/op 0.78
BeaconState ViewDU batchHashTreeRoot - commit step vc=200000 mod=100000 149.68 ms/op 167.85 ms/op 0.89
BeaconState ViewDU batchHashTreeRoot - hash step vc=200000 mod=100000 27.005 ms/op 37.827 ms/op 0.71
BeaconState ViewDU hashTreeRoot() vc=200000 mod=100000 418.46 ms/op 647.40 ms/op 0.65
BeaconState ViewDU hashTreeRoot - commit step vc=200000 mod=100000 32.338 ms/op 59.268 ms/op 0.55
BeaconState ViewDU hashTreeRoot - validator tree creation vc=100000 mod=100000 165.85 ms/op 239.83 ms/op 0.69
deserialize Attestation - tree 1.9510 us/op 3.0760 us/op 0.63
deserialize Attestation - struct 1.0580 us/op 1.6260 us/op 0.65
deserialize Attestation - struct (reuse bytes) 742.00 ns/op 1.1530 us/op 0.64
deserialize SignedAggregateAndProof - tree 2.7600 us/op 4.1700 us/op 0.66
deserialize SignedAggregateAndProof - struct 2.0370 us/op 2.7410 us/op 0.74
deserialize SignedAggregateAndProof - struct (reuse bytes) 979.00 ns/op 1.5230 us/op 0.64
deserialize SyncCommitteeMessage - tree 793.00 ns/op 1.1660 us/op 0.68
deserialize SyncCommitteeMessage - struct 715.00 ns/op 985.00 ns/op 0.73
deserialize SyncCommitteeMessage - struct (reuse bytes) 463.00 ns/op 601.00 ns/op 0.77
deserialize SignedContributionAndProof - tree 1.5910 us/op 2.4930 us/op 0.64
deserialize SignedContributionAndProof - struct 1.4800 us/op 2.2570 us/op 0.66
deserialize SignedContributionAndProof - struct (reuse bytes) 584.00 ns/op 992.00 ns/op 0.59
deserialize SignedBeaconBlock - tree 156.20 us/op 270.38 us/op 0.58
deserialize SignedBeaconBlock - struct 81.537 us/op 133.42 us/op 0.61
deserialize SignedBeaconBlock - struct (reuse bytes) 41.609 us/op 64.814 us/op 0.64
BeaconState vc 300000 - deserialize tree 206.61 ms/op 326.98 ms/op 0.63
BeaconState vc 300000 - serialize tree 94.838 ms/op 97.352 ms/op 0.97
BeaconState.historicalRoots vc 300000 - deserialize tree 497.00 ns/op 650.00 ns/op 0.76
BeaconState.historicalRoots vc 300000 - serialize tree 410.00 ns/op 563.00 ns/op 0.73
BeaconState.validators vc 300000 - deserialize tree 174.36 ms/op 295.07 ms/op 0.59
BeaconState.validators vc 300000 - serialize tree 32.789 ms/op 50.379 ms/op 0.65
BeaconState.balances vc 300000 - deserialize tree 5.9508 ms/op 7.9337 ms/op 0.75
BeaconState.balances vc 300000 - serialize tree 4.3701 ms/op 11.101 ms/op 0.39
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 515.14 us/op 682.23 us/op 0.76
BeaconState.previousEpochParticipation vc 300000 - serialize tree 612.24 us/op 599.98 us/op 1.02
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 464.83 us/op 682.53 us/op 0.68
BeaconState.currentEpochParticipation vc 300000 - serialize tree 588.54 us/op 647.88 us/op 0.91
BeaconState.inactivityScores vc 300000 - deserialize tree 5.6586 ms/op 7.9904 ms/op 0.71
BeaconState.inactivityScores vc 300000 - serialize tree 4.1947 ms/op 8.9604 ms/op 0.47
hashTreeRoot Attestation - struct 4.7850 us/op 7.7850 us/op 0.61
hashTreeRoot Attestation - tree 4.5730 us/op 7.1690 us/op 0.64
hashTreeRoot SignedAggregateAndProof - struct 6.9600 us/op 11.219 us/op 0.62
hashTreeRoot SignedAggregateAndProof - tree 6.7950 us/op 10.813 us/op 0.63
hashTreeRoot SyncCommitteeMessage - struct 1.6060 us/op 2.6740 us/op 0.60
hashTreeRoot SyncCommitteeMessage - tree 1.7240 us/op 2.6190 us/op 0.66
hashTreeRoot SignedContributionAndProof - struct 4.2780 us/op 6.7750 us/op 0.63
hashTreeRoot SignedContributionAndProof - tree 4.7130 us/op 7.4250 us/op 0.63
hashTreeRoot SignedBeaconBlock - struct 431.14 us/op 690.65 us/op 0.62
hashTreeRoot SignedBeaconBlock - tree 398.67 us/op 658.53 us/op 0.61
hashTreeRoot Validator - struct 2.5680 us/op 3.4400 us/op 0.75
hashTreeRoot Validator - tree 3.3880 us/op 5.3320 us/op 0.64
BeaconState vc 300000 - hashTreeRoot tree 1.1602 s/op 1.8122 s/op 0.64
BeaconState vc 300000 - batchHashTreeRoot tree 2.7882 s/op 3.4889 s/op 0.80
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 539.00 ns/op 772.00 ns/op 0.70
BeaconState.validators vc 300000 - hashTreeRoot tree 1.1339 s/op 1.8239 s/op 0.62
BeaconState.balances vc 300000 - hashTreeRoot tree 17.313 ms/op 28.489 ms/op 0.61
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 2.1904 ms/op 3.4580 ms/op 0.63
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 2.1641 ms/op 3.4547 ms/op 0.63
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 17.680 ms/op 28.045 ms/op 0.63
hash64 x18 3.7370 us/op 6.3560 us/op 0.59
hashTwoObjects x18 3.8730 us/op 6.3790 us/op 0.61
hash64 x1740 348.83 us/op 593.79 us/op 0.59
hashTwoObjects x1740 357.49 us/op 592.84 us/op 0.60
hash64 x2700000 552.56 ms/op 941.13 ms/op 0.59
hashTwoObjects x2700000 553.61 ms/op 922.08 ms/op 0.60
get_exitEpoch - ContainerType 91.000 ns/op 174.00 ns/op 0.52
get_exitEpoch - ContainerNodeStructType 92.000 ns/op 178.00 ns/op 0.52
set_exitEpoch - ContainerType 101.00 ns/op 203.00 ns/op 0.50
set_exitEpoch - ContainerNodeStructType 98.000 ns/op 179.00 ns/op 0.55
get_pubkey - ContainerType 587.00 ns/op 842.00 ns/op 0.70
get_pubkey - ContainerNodeStructType 95.000 ns/op 167.00 ns/op 0.57
hashTreeRoot - ContainerType 185.00 ns/op 294.00 ns/op 0.63
hashTreeRoot - ContainerNodeStructType 176.00 ns/op 289.00 ns/op 0.61
createProof - ContainerType 2.1450 us/op 3.0400 us/op 0.71
createProof - ContainerNodeStructType 13.334 us/op 17.780 us/op 0.75
serialize - ContainerType 1.0350 us/op 1.4730 us/op 0.70
serialize - ContainerNodeStructType 620.00 ns/op 1.0100 us/op 0.61
set_exitEpoch_and_hashTreeRoot - ContainerType 1.5130 us/op 2.0830 us/op 0.73
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 3.9140 us/op 5.9120 us/op 0.66
doBatchHashTreeRootValidators 2.7150 us/op 3.2000 us/op 0.85
ContainerNodeStructViewDU hashTreeRoot 14.242 us/op 20.935 us/op 0.68
Array - for of 2.5810 us/op 10.668 us/op 0.24
Array - for(;;) 2.1100 us/op 9.3350 us/op 0.23
basicListValue.readonlyValuesArray() 2.0226 ms/op 3.9211 ms/op 0.52
basicListValue.readonlyValuesArray() + loop all 2.8362 ms/op 6.3654 ms/op 0.45
compositeListValue.readonlyValuesArray() 7.2170 ms/op 10.751 ms/op 0.67
compositeListValue.readonlyValuesArray() + loop all 11.054 ms/op 10.763 ms/op 1.03
Number64UintType - get balances list 2.1124 ms/op 2.7800 ms/op 0.76
Number64UintType - set balances list 7.3214 ms/op 10.194 ms/op 0.72
Number64UintType - get and increase 10 then set 23.205 ms/op 30.944 ms/op 0.75
Number64UintType - increase 10 using applyDelta 9.5228 ms/op 16.604 ms/op 0.57
Number64UintType - increase 10 using applyDeltaInBatch 9.4568 ms/op 16.546 ms/op 0.57
tree_newTreeFromUint64Deltas 9.0828 ms/op 13.806 ms/op 0.66
unsafeUint8ArrayToTree 13.756 ms/op 20.486 ms/op 0.67
bitLength(50) 118.00 ns/op 184.00 ns/op 0.64
bitLengthStr(50) 123.00 ns/op 187.00 ns/op 0.66
bitLength(8000) 106.00 ns/op 182.00 ns/op 0.58
bitLengthStr(8000) 141.00 ns/op 232.00 ns/op 0.61
bitLength(250000) 105.00 ns/op 182.00 ns/op 0.58
bitLengthStr(250000) 176.00 ns/op 266.00 ns/op 0.66
merkleize 32 chunks 6.6510 us/op 11.160 us/op 0.60
merkleizeBlocksBytes 32 chunks 2.5480 us/op 2.7240 us/op 0.94
merkleizeBlockArray 32 chunks 3.8660 us/op 5.0060 us/op 0.77
merkleize 128 chunks 26.201 us/op 43.863 us/op 0.60
merkleizeBlocksBytes 128 chunks 7.0600 us/op 6.7490 us/op 1.05
merkleizeBlockArray 128 chunks 12.273 us/op 14.430 us/op 0.85
merkleize 512 chunks 105.45 us/op 175.83 us/op 0.60
merkleizeBlocksBytes 512 chunks 24.942 us/op 21.557 us/op 1.16
merkleizeBlockArray 512 chunks 43.870 us/op 49.774 us/op 0.88
merkleize 1024 chunks 211.79 us/op 356.44 us/op 0.59
merkleizeBlocksBytes 1024 chunks 48.653 us/op 40.871 us/op 1.19
merkleizeBlockArray 1024 chunks 93.259 us/op 96.496 us/op 0.97
floor - Math.floor (53) 0.30057 ns/op 0.35012 ns/op 0.86
floor - << 0 (53) 0.30070 ns/op 0.35011 ns/op 0.86
floor - Math.floor (512) 0.30069 ns/op 0.35012 ns/op 0.86
floor - << 0 (512) 0.30052 ns/op 0.35030 ns/op 0.86
fnIf(0) 1.2011 ns/op 1.5017 ns/op 0.80
fnSwitch(0) 2.1623 ns/op 2.4886 ns/op 0.87
fnObj(0) 0.30050 ns/op 0.35018 ns/op 0.86
fnArr(0) 0.30073 ns/op 0.34998 ns/op 0.86
fnIf(4) 2.1815 ns/op 2.1781 ns/op 1.00
fnSwitch(4) 2.1845 ns/op 2.1765 ns/op 1.00
fnObj(4) 0.34093 ns/op 0.34999 ns/op 0.97
fnArr(4) 0.34049 ns/op 0.35002 ns/op 0.97
fnIf(9) 2.9032 ns/op 3.1111 ns/op 0.93
fnSwitch(9) 2.1847 ns/op 2.1793 ns/op 1.00
fnObj(9) 0.30054 ns/op 0.35012 ns/op 0.86
fnArr(9) 0.30044 ns/op 0.35006 ns/op 0.86
Container {a,b,vec} - as struct x100000 29.920 us/op 34.831 us/op 0.86
Container {a,b,vec} - as tree x100000 372.15 us/op 1.2152 ms/op 0.31
Container {a,vec,b} - as struct x100000 71.671 us/op 77.222 us/op 0.93
Container {a,vec,b} - as tree x100000 384.05 us/op 1.2145 ms/op 0.32
get 2 props x1000000 - rawObject 240.40 us/op 311.26 us/op 0.77
get 2 props x1000000 - proxy 56.921 ms/op 78.955 ms/op 0.72
get 2 props x1000000 - customObj 240.40 us/op 311.33 us/op 0.77
Simple object binary -> struct 238.00 ns/op 445.00 ns/op 0.53
Simple object binary -> tree_backed 540.00 ns/op 954.00 ns/op 0.57
Simple object struct -> tree_backed 961.00 ns/op 1.4960 us/op 0.64
Simple object tree_backed -> struct 784.00 ns/op 1.2570 us/op 0.62
Simple object struct -> binary 448.00 ns/op 772.00 ns/op 0.58
Simple object tree_backed -> binary 747.00 ns/op 1.0470 us/op 0.71
aggregationBits binary -> struct 192.00 ns/op 379.00 ns/op 0.51
aggregationBits binary -> tree_backed 1.3000 us/op 1.8950 us/op 0.69
aggregationBits struct -> tree_backed 1.5230 us/op 2.3990 us/op 0.63
aggregationBits tree_backed -> struct 555.00 ns/op 921.00 ns/op 0.60
aggregationBits struct -> binary 391.00 ns/op 714.00 ns/op 0.55
aggregationBits tree_backed -> binary 462.00 ns/op 741.00 ns/op 0.62
List(uint8) 100000 binary -> struct 473.57 us/op 711.87 us/op 0.67
List(uint8) 100000 binary -> tree_backed 158.00 us/op 229.31 us/op 0.69
List(uint8) 100000 struct -> tree_backed 975.83 us/op 1.4957 ms/op 0.65
List(uint8) 100000 tree_backed -> struct 558.61 us/op 832.45 us/op 0.67
List(uint8) 100000 struct -> binary 908.17 us/op 1.3531 ms/op 0.67
List(uint8) 100000 tree_backed -> binary 148.16 us/op 261.83 us/op 0.57
List(uint64Number) 100000 binary -> struct 798.91 us/op 1.0609 ms/op 0.75
List(uint64Number) 100000 binary -> tree_backed 1.4042 ms/op 1.9409 ms/op 0.72
List(uint64Number) 100000 struct -> tree_backed 2.4108 ms/op 3.6972 ms/op 0.65
List(uint64Number) 100000 tree_backed -> struct 1.5863 ms/op 2.2761 ms/op 0.70
List(uint64Number) 100000 struct -> binary 1.6701 ms/op 2.2608 ms/op 0.74
List(uint64Number) 100000 tree_backed -> binary 1.3557 ms/op 961.71 us/op 1.41
List(Uint64Bigint) 100000 binary -> struct 1.1919 ms/op 1.5911 ms/op 0.75
List(Uint64Bigint) 100000 binary -> tree_backed 1.4372 ms/op 1.9500 ms/op 0.74
List(Uint64Bigint) 100000 struct -> tree_backed 2.3685 ms/op 3.5255 ms/op 0.67
List(Uint64Bigint) 100000 tree_backed -> struct 2.0237 ms/op 3.2551 ms/op 0.62
List(Uint64Bigint) 100000 struct -> binary 1.4310 ms/op 2.0645 ms/op 0.69
List(Uint64Bigint) 100000 tree_backed -> binary 1.3190 ms/op 937.57 us/op 1.41
Vector(Root) 100000 binary -> struct 8.8446 ms/op 11.923 ms/op 0.74
Vector(Root) 100000 binary -> tree_backed 12.893 ms/op 17.559 ms/op 0.73
Vector(Root) 100000 struct -> tree_backed 14.362 ms/op 20.084 ms/op 0.72
Vector(Root) 100000 tree_backed -> struct 16.328 ms/op 15.454 ms/op 1.06
Vector(Root) 100000 struct -> binary 3.5243 ms/op 5.5020 ms/op 0.64
Vector(Root) 100000 tree_backed -> binary 5.2104 ms/op 5.3952 ms/op 0.97
List(Validator) 100000 binary -> struct 46.156 ms/op 67.299 ms/op 0.69
List(Validator) 100000 binary -> tree_backed 157.74 ms/op 197.41 ms/op 0.80
List(Validator) 100000 struct -> tree_backed 166.04 ms/op 224.06 ms/op 0.74
List(Validator) 100000 tree_backed -> struct 88.543 ms/op 145.33 ms/op 0.61
List(Validator) 100000 struct -> binary 25.020 ms/op 42.871 ms/op 0.58
List(Validator) 100000 tree_backed -> binary 33.999 ms/op 77.546 ms/op 0.44
List(Validator-NS) 100000 binary -> struct 44.750 ms/op 66.656 ms/op 0.67
List(Validator-NS) 100000 binary -> tree_backed 55.067 ms/op 100.46 ms/op 0.55
List(Validator-NS) 100000 struct -> tree_backed 82.928 ms/op 126.41 ms/op 0.66
List(Validator-NS) 100000 tree_backed -> struct 82.865 ms/op 90.256 ms/op 0.92
List(Validator-NS) 100000 struct -> binary 8.7201 ms/op 11.233 ms/op 0.78
List(Validator-NS) 100000 tree_backed -> binary 12.122 ms/op 22.403 ms/op 0.54
get epochStatuses - MutableVector 91.190 us/op 126.19 us/op 0.72
get epochStatuses - ViewDU 137.19 us/op 207.20 us/op 0.66
set epochStatuses - ListTreeView 1.4650 ms/op 1.8818 ms/op 0.78
set epochStatuses - ListTreeView - set() 403.96 us/op 495.01 us/op 0.82
set epochStatuses - ListTreeView - commit() 538.45 us/op 802.72 us/op 0.67
bitstring 350.46 ns/op 456.90 ns/op 0.77
bit mask 5.0403 ns/op 7.2173 ns/op 0.70
struct - increase slot to 1000000 274.59 us/op 350.13 us/op 0.78
UintNumberType - increase slot to 1000000 14.745 ms/op 27.131 ms/op 0.54
UintBigintType - increase slot to 1000000 99.250 ms/op 164.44 ms/op 0.60
UintBigint8 x 100000 tree_deserialize 3.6265 ms/op 5.1160 ms/op 0.71
UintBigint8 x 100000 tree_serialize 917.88 us/op 1.2315 ms/op 0.75
UintBigint16 x 100000 tree_deserialize 3.9272 ms/op 5.1206 ms/op 0.77
UintBigint16 x 100000 tree_serialize 1.1497 ms/op 640.62 us/op 1.79
UintBigint32 x 100000 tree_deserialize 3.0803 ms/op 4.2658 ms/op 0.72
UintBigint32 x 100000 tree_serialize 1.1955 ms/op 1.3363 ms/op 0.89
UintBigint64 x 100000 tree_deserialize 3.6347 ms/op 5.0786 ms/op 0.72
UintBigint64 x 100000 tree_serialize 1.4282 ms/op 1.4705 ms/op 0.97
UintBigint8 x 100000 value_deserialize 368.30 us/op 404.70 us/op 0.91
UintBigint8 x 100000 value_serialize 467.92 us/op 382.87 us/op 1.22
UintBigint16 x 100000 value_deserialize 386.71 us/op 466.89 us/op 0.83
UintBigint16 x 100000 value_serialize 468.63 us/op 372.96 us/op 1.26
UintBigint32 x 100000 value_deserialize 412.80 us/op 466.87 us/op 0.88
UintBigint32 x 100000 value_serialize 470.30 us/op 420.65 us/op 1.12
UintBigint64 x 100000 value_deserialize 396.45 us/op 529.13 us/op 0.75
UintBigint64 x 100000 value_serialize 560.48 us/op 560.71 us/op 1.00
UintBigint8 x 100000 deserialize 1.6609 ms/op 1.9547 ms/op 0.85
UintBigint8 x 100000 serialize 1.0046 ms/op 1.5883 ms/op 0.63
UintBigint16 x 100000 deserialize 1.5696 ms/op 2.0593 ms/op 0.76
UintBigint16 x 100000 serialize 915.71 us/op 3.1908 ms/op 0.29
UintBigint32 x 100000 deserialize 1.6878 ms/op 1.9335 ms/op 0.87
UintBigint32 x 100000 serialize 1.6113 ms/op 2.9584 ms/op 0.54
UintBigint64 x 100000 deserialize 1.5851 ms/op 1.9438 ms/op 0.82
UintBigint64 x 100000 serialize 816.40 us/op 1.2405 ms/op 0.66
UintBigint128 x 100000 deserialize 1.8194 ms/op 2.2284 ms/op 0.82
UintBigint128 x 100000 serialize 6.5407 ms/op 12.854 ms/op 0.51
UintBigint256 x 100000 deserialize 2.6912 ms/op 3.0918 ms/op 0.87
UintBigint256 x 100000 serialize 20.884 ms/op 38.538 ms/op 0.54
Slice from Uint8Array x25000 721.64 us/op 971.96 us/op 0.74
Slice from ArrayBuffer x25000 8.4873 ms/op 11.503 ms/op 0.74
Slice from ArrayBuffer x25000 + new Uint8Array 11.863 ms/op 17.728 ms/op 0.67
Copy Uint8Array 100000 iterate 730.15 us/op 882.77 us/op 0.83
Copy Uint8Array 100000 slice 185.88 us/op 199.54 us/op 0.93
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 119.92 us/op 78.781 us/op 1.52
Copy Buffer 100000 Uint8Array.prototype.slice.call 117.26 us/op 76.688 us/op 1.53
Copy Uint8Array 100000 slice + set 269.44 us/op 154.02 us/op 1.75
Copy Uint8Array 100000 subarray + set 117.45 us/op 75.378 us/op 1.56
Copy Uint8Array 100000 slice arrayBuffer 117.26 us/op 75.833 us/op 1.55
Uint64 deserialize 100000 - iterate Uint8Array 827.88 us/op 1.3277 ms/op 0.62
Uint64 deserialize 100000 - by Uint32A 829.82 us/op 1.3477 ms/op 0.62
Uint64 deserialize 100000 - by DataView.getUint32 x2 895.23 us/op 1.4955 ms/op 0.60
Uint64 deserialize 100000 - by DataView.getBigUint64 2.6572 ms/op 3.8719 ms/op 0.69
Uint64 deserialize 100000 - by byte 10.735 ms/op 15.829 ms/op 0.68

by benchmarkbot/action

@nflaig nflaig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems good to me, @wemeetagain should probably give this a review

@wemeetagain
wemeetagain merged commit 2b876ad into master Aug 17, 2026
12 checks passed
@wemeetagain
wemeetagain deleted the te/fix_readVariableOffsetsArrayComposite branch August 17, 2026 19:11
@github-actions github-actions Bot mentioned this pull request Aug 18, 2026
wemeetagain pushed a commit that referenced this pull request Aug 18, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>as-sha256: 1.2.5</summary>

##
[1.2.5](as-sha256-v1.2.4...as-sha256-v1.2.5)
(2026-08-18)


### Miscellaneous

* reduce test workflow critical path
([#539](#539))
([dcc065d](dcc065d))
</details>

<details><summary>persistent-merkle-tree: 1.3.1</summary>

##
[1.3.1](persistent-merkle-tree-v1.3.0...persistent-merkle-tree-v1.3.1)
(2026-08-18)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @chainsafe/as-sha256 bumped to 1.2.5
</details>

<details><summary>ssz: 1.6.3</summary>

##
[1.6.3](ssz-v1.6.2...ssz-v1.6.3)
(2026-08-18)


### Bug Fixes

* check first offset in readVariableOffsetsArrayComposite
([#543](#543))
([2b876ad](2b876ad))


### Miscellaneous

* reduce test workflow critical path
([#539](#539))
([dcc065d](dcc065d))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @chainsafe/as-sha256 bumped to 1.2.5
    * @chainsafe/persistent-merkle-tree bumped to 1.3.1
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wemeetagain pushed a commit to ChainSafe/lodestar that referenced this pull request Aug 21, 2026
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