Skip to content

Conversation

@wemeetagain
Copy link
Member

Motivation

Description

  • Add reuseBytes option which causes deserialize to use Uint8Array#subarray instead of Uint8Array#slice. This will cause the deserialized object to share the backing ArrayBuffer of the serialized payload. This is helpful, in some cases, to avoid additional allocations, however special care must be given to avoid corrupting memory using this option. The default behavior of deserialize is unchanged.

@wemeetagain wemeetagain requested a review from a team as a code owner November 22, 2025 13:45
@github-actions github-actions bot added the ssz label Nov 22, 2025
@wemeetagain wemeetagain enabled auto-merge (squash) November 22, 2025 13:57
@wemeetagain wemeetagain merged commit b1e55bc into master Nov 22, 2025
8 of 10 checks passed
@wemeetagain wemeetagain deleted the cayman/reuse-buffer branch November 22, 2025 14:12
@github-actions
Copy link

github-actions bot commented Nov 22, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 71a0fa2 Previous: 7f5580c Ratio
digestTwoHashObjects 50023 times 47.988 ms/op 48.190 ms/op 1.00
digest2Bytes32 50023 times 54.814 ms/op 55.701 ms/op 0.98
digest 50023 times 52.862 ms/op 53.378 ms/op 0.99
input length 32 1.2090 us/op 1.1970 us/op 1.01
input length 64 1.3680 us/op 1.3530 us/op 1.01
input length 128 2.3260 us/op 2.3350 us/op 1.00
input length 256 3.4540 us/op 3.4560 us/op 1.00
input length 512 5.6160 us/op 5.7640 us/op 0.97
input length 1024 10.679 us/op 10.828 us/op 0.99
digest 1000000 times 871.99 ms/op 851.86 ms/op 1.02
hashObjectToByteArray 50023 times 934.32 us/op 937.20 us/op 1.00
byteArrayToHashObject 50023 times 1.3208 ms/op 1.3088 ms/op 1.01
digest64 200092 times 211.63 ms/op 215.58 ms/op 0.98
hash 200092 times using batchHash4UintArray64s 233.95 ms/op 230.80 ms/op 1.01
digest64HashObjects 200092 times 190.80 ms/op 191.43 ms/op 1.00
hash 200092 times using batchHash4HashObjectInputs 194.21 ms/op 198.54 ms/op 0.98
getGindicesAtDepth 3.7150 us/op 3.6320 us/op 1.02
iterateAtDepth 6.3910 us/op 6.4330 us/op 0.99
getGindexBits 440.00 ns/op 441.00 ns/op 1.00
gindexIterator 892.00 ns/op 902.00 ns/op 0.99
HashComputationLevel.push then loop 26.773 ms/op 26.098 ms/op 1.03
HashComputation[] push then loop 39.338 ms/op 47.646 ms/op 0.83
hash 2 32 bytes Uint8Array 500000 times - hashtree 148.94 ms/op 146.96 ms/op 1.01
batch hash 16 x 64 Uint8Array 31250 times - hashtree 24.362 ms/op 24.511 ms/op 0.99
hashTwoObjects 500000 times - hashtree 175.58 ms/op 164.29 ms/op 1.07
executeHashComputations - hashtree 9.2564 ms/op 9.1375 ms/op 1.01
hash 2 32 bytes Uint8Array 500000 times - as-sha256 490.06 ms/op 490.28 ms/op 1.00
batch hash 16 x 64 Uint8Array 31250 times - as-sha256 502.18 ms/op 518.62 ms/op 0.97
hashTwoObjects 500000 times - as-sha256 504.06 ms/op 505.97 ms/op 1.00
executeHashComputations - as-sha256 45.206 ms/op 43.679 ms/op 1.03
hash 2 32 bytes Uint8Array 500000 times - noble 1.2507 s/op 1.2312 s/op 1.02
batch hash 16 x 64 Uint8Array 31250 times - noble 1.2176 s/op 1.1810 s/op 1.03
hashTwoObjects 500000 times - noble 1.6215 s/op 1.5427 s/op 1.05
executeHashComputations - noble 36.340 ms/op 36.224 ms/op 1.00
getHashComputations 2.3617 ms/op 2.3532 ms/op 1.00
executeHashComputations 10.173 ms/op 8.9486 ms/op 1.14
get root 12.604 ms/op 12.151 ms/op 1.04
getNodeH() x7812.5 avg hindex 12.073 us/op 12.044 us/op 1.00
getNodeH() x7812.5 index 0 7.6240 us/op 7.5480 us/op 1.01
getNodeH() x7812.5 index 7 7.4650 us/op 7.4780 us/op 1.00
getNodeH() x7812.5 index 7 with key array 6.2540 us/op 6.4380 us/op 0.97
new LeafNode() x7812.5 314.23 us/op 308.35 us/op 1.02
getHashComputations 250000 nodes 14.994 ms/op 14.886 ms/op 1.01
batchHash 250000 nodes 89.138 ms/op 87.862 ms/op 1.01
get root 250000 nodes 94.340 ms/op 91.263 ms/op 1.03
getHashComputations 500000 nodes 28.060 ms/op 28.213 ms/op 0.99
batchHash 500000 nodes 148.28 ms/op 150.27 ms/op 0.99
get root 500000 nodes 188.63 ms/op 181.45 ms/op 1.04
getHashComputations 1000000 nodes 62.561 ms/op 55.266 ms/op 1.13
batchHash 1000000 nodes 302.91 ms/op 337.47 ms/op 0.90
get root 1000000 nodes 381.22 ms/op 374.83 ms/op 1.02
multiproof - depth 15, 1 requested leaves 7.9570 us/op 7.7640 us/op 1.02
tree offset multiproof - depth 15, 1 requested leaves 16.991 us/op 17.414 us/op 0.98
compact multiproof - depth 15, 1 requested leaves 3.3070 us/op 3.5970 us/op 0.92
multiproof - depth 15, 2 requested leaves 11.192 us/op 11.502 us/op 0.97
tree offset multiproof - depth 15, 2 requested leaves 20.884 us/op 21.008 us/op 0.99
compact multiproof - depth 15, 2 requested leaves 3.2670 us/op 3.3690 us/op 0.97
multiproof - depth 15, 3 requested leaves 15.818 us/op 15.834 us/op 1.00
tree offset multiproof - depth 15, 3 requested leaves 27.703 us/op 26.930 us/op 1.03
compact multiproof - depth 15, 3 requested leaves 5.3770 us/op 4.0250 us/op 1.34
multiproof - depth 15, 4 requested leaves 23.862 us/op 21.233 us/op 1.12
tree offset multiproof - depth 15, 4 requested leaves 33.395 us/op 33.884 us/op 0.99
compact multiproof - depth 15, 4 requested leaves 4.1170 us/op 4.0360 us/op 1.02
packedRootsBytesToLeafNodes bytes 4000 offset 0 5.6560 us/op 5.7160 us/op 0.99
packedRootsBytesToLeafNodes bytes 4000 offset 1 5.6120 us/op 5.9350 us/op 0.95
packedRootsBytesToLeafNodes bytes 4000 offset 2 5.6360 us/op 5.7620 us/op 0.98
packedRootsBytesToLeafNodes bytes 4000 offset 3 5.6680 us/op 5.7520 us/op 0.99
subtreeFillToContents depth 40 count 250000 47.657 ms/op 48.649 ms/op 0.98
setRoot - gindexBitstring 21.658 ms/op 20.208 ms/op 1.07
setRoot - gindex 22.449 ms/op 20.336 ms/op 1.10
getRoot - gindexBitstring 2.6076 ms/op 2.3656 ms/op 1.10
getRoot - gindex 3.0911 ms/op 3.0761 ms/op 1.00
getHashObject then setHashObject 25.030 ms/op 22.569 ms/op 1.11
setNodeWithFn 20.019 ms/op 18.894 ms/op 1.06
getNodeAtDepth depth 0 x100000 281.34 us/op 280.71 us/op 1.00
setNodeAtDepth depth 0 x100000 2.6201 ms/op 2.2554 ms/op 1.16
getNodesAtDepth depth 0 x100000 313.99 us/op 312.44 us/op 1.00
setNodesAtDepth depth 0 x100000 854.02 us/op 888.65 us/op 0.96
getNodeAtDepth depth 1 x100000 342.55 us/op 342.17 us/op 1.00
setNodeAtDepth depth 1 x100000 8.8243 ms/op 7.4786 ms/op 1.18
getNodesAtDepth depth 1 x100000 435.95 us/op 436.36 us/op 1.00
setNodesAtDepth depth 1 x100000 7.1682 ms/op 6.4007 ms/op 1.12
getNodeAtDepth depth 2 x100000 759.40 us/op 760.36 us/op 1.00
setNodeAtDepth depth 2 x100000 15.742 ms/op 14.330 ms/op 1.10
getNodesAtDepth depth 2 x100000 20.202 ms/op 18.084 ms/op 1.12
setNodesAtDepth depth 2 x100000 24.629 ms/op 21.401 ms/op 1.15
tree.getNodesAtDepth - gindexes 8.9256 ms/op 8.2011 ms/op 1.09
tree.getNodesAtDepth - push all nodes 2.3977 ms/op 1.8670 ms/op 1.28
tree.getNodesAtDepth - navigation 311.51 us/op 311.87 us/op 1.00
tree.setNodesAtDepth - indexes 742.26 us/op 633.37 us/op 1.17
set at depth 8 863.00 ns/op 784.00 ns/op 1.10
set at depth 16 1.2030 us/op 1.0230 us/op 1.18
set at depth 32 2.0450 us/op 1.8730 us/op 1.09
iterateNodesAtDepth 8 256 13.898 us/op 13.181 us/op 1.05
getNodesAtDepth 8 256 3.7350 us/op 3.6480 us/op 1.02
iterateNodesAtDepth 16 65536 4.7616 ms/op 4.3650 ms/op 1.09
getNodesAtDepth 16 65536 1.2062 ms/op 1.1395 ms/op 1.06
iterateNodesAtDepth 32 250000 17.050 ms/op 15.916 ms/op 1.07
getNodesAtDepth 32 250000 5.0151 ms/op 4.5080 ms/op 1.11
iterateNodesAtDepth 40 250000 17.218 ms/op 15.770 ms/op 1.09
getNodesAtDepth 40 250000 5.0517 ms/op 4.5316 ms/op 1.11
250000 validators root getter 94.884 ms/op 94.698 ms/op 1.00
250000 validators batchHash() 88.348 ms/op 89.668 ms/op 0.99
250000 validators hashComputations 13.862 ms/op 15.712 ms/op 0.88
bitlist bytes to struct (120,90) 501.00 ns/op 558.00 ns/op 0.90
bitlist bytes to tree (120,90) 2.2740 us/op 2.2640 us/op 1.00
bitlist bytes to struct (2048,2048) 888.00 ns/op 898.00 ns/op 0.99
bitlist bytes to tree (2048,2048) 3.6970 us/op 3.4680 us/op 1.07
ByteListType - deserialize 9.3787 ms/op 9.4935 ms/op 0.99
BasicListType - deserialize 10.186 ms/op 9.9673 ms/op 1.02
ByteListType - serialize 9.4340 ms/op 9.5271 ms/op 0.99
BasicListType - serialize 11.298 ms/op 11.928 ms/op 0.95
BasicListType - tree_convertToStruct 21.871 ms/op 21.471 ms/op 1.02
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.3272 ms/op 5.3298 ms/op 1.00
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.3717 ms/op 4.3888 ms/op 1.00
Array.push len 300000 empty Array - number 7.5224 ms/op 6.8916 ms/op 1.09
Array.set len 300000 from new Array - number 2.3377 ms/op 1.7659 ms/op 1.32
Array.set len 300000 - number 5.8497 ms/op 5.7140 ms/op 1.02
Uint8Array.set len 300000 382.66 us/op 383.00 us/op 1.00
Uint32Array.set len 300000 452.08 us/op 456.62 us/op 0.99
Container({a: uint8, b: uint8}) getViewDU x300000 29.423 ms/op 28.862 ms/op 1.02
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 10.817 ms/op 10.531 ms/op 1.03
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 210.03 ms/op 208.89 ms/op 1.01
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 241.73 ms/op 234.33 ms/op 1.03
List(Container) len 300000 ViewDU.get(i) 6.5445 ms/op 6.5948 ms/op 0.99
List(Container) len 300000 ViewDU.getReadonly(i) 6.5893 ms/op 6.5451 ms/op 1.01
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 38.090 ms/op 36.448 ms/op 1.05
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.2761 ms/op 5.3517 ms/op 0.99
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.2562 ms/op 6.1686 ms/op 1.01
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.2484 ms/op 6.2692 ms/op 1.00
Array.push len 300000 empty Array - object 6.6010 ms/op 6.4726 ms/op 1.02
Array.set len 300000 from new Array - object 2.0440 ms/op 2.0467 ms/op 1.00
Array.set len 300000 - object 6.4485 ms/op 6.2633 ms/op 1.03
cachePermanentRootStruct no cache 3.1530 us/op 3.1640 us/op 1.00
cachePermanentRootStruct with cache 169.00 ns/op 186.00 ns/op 0.91
epochParticipation len 250000 rws 7813 2.4286 ms/op 2.3874 ms/op 1.02
Deneb BeaconBlock.hashTreeRoot(), numTransaction=200 4.7286 ms/op 4.7199 ms/op 1.00
BeaconState ViewDU batchHashTreeRoot vc=200000 mod=100000 214.20 ms/op 213.63 ms/op 1.00
BeaconState ViewDU batchHashTreeRoot - commit step vc=200000 mod=100000 182.03 ms/op 180.52 ms/op 1.01
BeaconState ViewDU batchHashTreeRoot - hash step vc=200000 mod=100000 46.632 ms/op 47.817 ms/op 0.98
BeaconState ViewDU hashTreeRoot() vc=200000 mod=100000 692.51 ms/op 701.72 ms/op 0.99
BeaconState ViewDU hashTreeRoot - commit step vc=200000 mod=100000 63.491 ms/op 64.961 ms/op 0.98
BeaconState ViewDU hashTreeRoot - validator tree creation vc=100000 mod=100000 280.49 ms/op 271.08 ms/op 1.03
deserialize Attestation - tree 3.7070 us/op 3.6980 us/op 1.00
deserialize Attestation - struct 1.9320 us/op 1.9670 us/op 0.98
deserialize Attestation - struct (reuse bytes) 1.4440 us/op
deserialize SignedAggregateAndProof - tree 4.8620 us/op 4.9070 us/op 0.99
deserialize SignedAggregateAndProof - struct 3.0720 us/op 3.0410 us/op 1.01
deserialize SignedAggregateAndProof - struct (reuse bytes) 1.9170 us/op
deserialize SyncCommitteeMessage - tree 1.4710 us/op 1.5260 us/op 0.96
deserialize SyncCommitteeMessage - struct 1.1120 us/op 1.1650 us/op 0.95
deserialize SyncCommitteeMessage - struct (reuse bytes) 773.00 ns/op
deserialize SignedContributionAndProof - tree 2.8720 us/op 2.8900 us/op 0.99
deserialize SignedContributionAndProof - struct 2.3790 us/op 2.4160 us/op 0.98
deserialize SignedContributionAndProof - struct (reuse bytes) 1.3290 us/op
deserialize SignedBeaconBlock - tree 306.53 us/op 283.97 us/op 1.08
deserialize SignedBeaconBlock - struct 131.90 us/op 117.38 us/op 1.12
deserialize SignedBeaconBlock - struct (reuse bytes) 81.886 us/op
BeaconState vc 300000 - deserialize tree 643.71 ms/op 629.34 ms/op 1.02
BeaconState vc 300000 - serialize tree 104.95 ms/op 105.94 ms/op 0.99
BeaconState.historicalRoots vc 300000 - deserialize tree 998.00 ns/op 997.00 ns/op 1.00
BeaconState.historicalRoots vc 300000 - serialize tree 681.00 ns/op 678.00 ns/op 1.00
BeaconState.validators vc 300000 - deserialize tree 609.12 ms/op 611.03 ms/op 1.00
BeaconState.validators vc 300000 - serialize tree 38.413 ms/op 32.923 ms/op 1.17
BeaconState.balances vc 300000 - deserialize tree 25.922 ms/op 28.280 ms/op 0.92
BeaconState.balances vc 300000 - serialize tree 4.0636 ms/op 3.9668 ms/op 1.02
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 951.31 us/op 1.0094 ms/op 0.94
BeaconState.previousEpochParticipation vc 300000 - serialize tree 332.97 us/op 327.38 us/op 1.02
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 951.83 us/op 1.0154 ms/op 0.94
BeaconState.currentEpochParticipation vc 300000 - serialize tree 328.51 us/op 325.88 us/op 1.01
BeaconState.inactivityScores vc 300000 - deserialize tree 24.638 ms/op 25.286 ms/op 0.97
BeaconState.inactivityScores vc 300000 - serialize tree 3.9917 ms/op 3.8505 ms/op 1.04
hashTreeRoot Attestation - struct 9.3600 us/op 9.3840 us/op 1.00
hashTreeRoot Attestation - tree 7.3250 us/op 7.4360 us/op 0.99
hashTreeRoot SignedAggregateAndProof - struct 12.947 us/op 12.235 us/op 1.06
hashTreeRoot SignedAggregateAndProof - tree 11.040 us/op 10.949 us/op 1.01
hashTreeRoot SyncCommitteeMessage - struct 3.0750 us/op 3.1110 us/op 0.99
hashTreeRoot SyncCommitteeMessage - tree 2.8070 us/op 2.7860 us/op 1.01
hashTreeRoot SignedContributionAndProof - struct 7.5620 us/op 7.3990 us/op 1.02
hashTreeRoot SignedContributionAndProof - tree 7.5870 us/op 7.5490 us/op 1.01
hashTreeRoot SignedBeaconBlock - struct 745.95 us/op 714.10 us/op 1.04
hashTreeRoot SignedBeaconBlock - tree 670.27 us/op 663.99 us/op 1.01
hashTreeRoot Validator - struct 4.3630 us/op 4.3710 us/op 1.00
hashTreeRoot Validator - tree 5.7610 us/op 5.7160 us/op 1.01
BeaconState vc 300000 - hashTreeRoot tree 1.9587 s/op 2.0179 s/op 0.97
BeaconState vc 300000 - batchHashTreeRoot tree 3.9651 s/op 3.9309 s/op 1.01
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 828.00 ns/op 852.00 ns/op 0.97
BeaconState.validators vc 300000 - hashTreeRoot tree 2.1518 s/op 2.1653 s/op 0.99
BeaconState.balances vc 300000 - hashTreeRoot tree 31.910 ms/op 27.897 ms/op 1.14
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 3.5525 ms/op 3.4708 ms/op 1.02
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 3.5050 ms/op 3.4667 ms/op 1.01
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 28.086 ms/op 27.772 ms/op 1.01
hash64 x18 7.7170 us/op 7.7540 us/op 1.00
hashTwoObjects x18 6.6930 us/op 6.4950 us/op 1.03
hash64 x1740 698.90 us/op 662.69 us/op 1.05
hashTwoObjects x1740 617.72 us/op 584.68 us/op 1.06
hash64 x2700000 1.0646 s/op 995.69 ms/op 1.07
hashTwoObjects x2700000 960.95 ms/op 910.98 ms/op 1.05
get_exitEpoch - ContainerType 237.00 ns/op 243.00 ns/op 0.98
get_exitEpoch - ContainerNodeStructType 233.00 ns/op 260.00 ns/op 0.90
set_exitEpoch - ContainerType 264.00 ns/op 251.00 ns/op 1.05
set_exitEpoch - ContainerNodeStructType 245.00 ns/op 236.00 ns/op 1.04
get_pubkey - ContainerType 1.0010 us/op 935.00 ns/op 1.07
get_pubkey - ContainerNodeStructType 227.00 ns/op 227.00 ns/op 1.00
hashTreeRoot - ContainerType 553.00 ns/op 467.00 ns/op 1.18
hashTreeRoot - ContainerNodeStructType 428.00 ns/op 458.00 ns/op 0.93
createProof - ContainerType 3.6310 us/op 3.5940 us/op 1.01
createProof - ContainerNodeStructType 19.416 us/op 19.945 us/op 0.97
serialize - ContainerType 1.6940 us/op 1.6990 us/op 1.00
serialize - ContainerNodeStructType 1.1040 us/op 1.1520 us/op 0.96
set_exitEpoch_and_hashTreeRoot - ContainerType 2.5280 us/op 2.5450 us/op 0.99
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 6.4990 us/op 6.4140 us/op 1.01
doBatchHashTreeRootValidators 3.5400 us/op 3.5620 us/op 0.99
ContainerNodeStructViewDU hashTreeRoot 22.262 us/op 22.103 us/op 1.01
Array - for of 5.5550 us/op 10.627 us/op 0.52
Array - for(;;) 5.5550 us/op 10.567 us/op 0.53
basicListValue.readonlyValuesArray() 3.7039 ms/op 4.4933 ms/op 0.82
basicListValue.readonlyValuesArray() + loop all 3.9059 ms/op 4.6712 ms/op 0.84
compositeListValue.readonlyValuesArray() 29.547 ms/op 29.964 ms/op 0.99
compositeListValue.readonlyValuesArray() + loop all 31.475 ms/op 30.799 ms/op 1.02
Number64UintType - get balances list 4.4733 ms/op 4.5386 ms/op 0.99
Number64UintType - set balances list 10.186 ms/op 9.9799 ms/op 1.02
Number64UintType - get and increase 10 then set 40.684 ms/op 41.072 ms/op 0.99
Number64UintType - increase 10 using applyDelta 17.616 ms/op 17.383 ms/op 1.01
Number64UintType - increase 10 using applyDeltaInBatch 17.922 ms/op 18.718 ms/op 0.96
tree_newTreeFromUint64Deltas 22.958 ms/op 22.175 ms/op 1.04
unsafeUint8ArrayToTree 34.034 ms/op 35.680 ms/op 0.95
bitLength(50) 251.00 ns/op 245.00 ns/op 1.02
bitLengthStr(50) 228.00 ns/op 225.00 ns/op 1.01
bitLength(8000) 234.00 ns/op 244.00 ns/op 0.96
bitLengthStr(8000) 277.00 ns/op 295.00 ns/op 0.94
bitLength(250000) 233.00 ns/op 236.00 ns/op 0.99
bitLengthStr(250000) 329.00 ns/op 308.00 ns/op 1.07
merkleize 32 chunks 12.603 us/op 12.454 us/op 1.01
merkleizeBlocksBytes 32 chunks 3.2120 us/op 3.0590 us/op 1.05
merkleizeBlockArray 32 chunks 6.1650 us/op 6.2340 us/op 0.99
merkleize 128 chunks 50.079 us/op 48.902 us/op 1.02
merkleizeBlocksBytes 128 chunks 7.4050 us/op 7.1610 us/op 1.03
merkleizeBlockArray 128 chunks 17.400 us/op 17.304 us/op 1.01
merkleize 512 chunks 199.12 us/op 189.23 us/op 1.05
merkleizeBlocksBytes 512 chunks 22.627 us/op 22.816 us/op 0.99
merkleizeBlockArray 512 chunks 61.095 us/op 61.385 us/op 1.00
merkleize 1024 chunks 399.17 us/op 382.61 us/op 1.04
merkleizeBlocksBytes 1024 chunks 42.024 us/op 42.173 us/op 1.00
merkleizeBlockArray 1024 chunks 117.23 us/op 116.17 us/op 1.01
floor - Math.floor (53) 1.2434 ns/op 1.2435 ns/op 1.00
floor - << 0 (53) 1.2446 ns/op 1.2457 ns/op 1.00
floor - Math.floor (512) 1.2454 ns/op 1.2436 ns/op 1.00
floor - << 0 (512) 1.2434 ns/op 1.2458 ns/op 1.00
fnIf(0) 1.5569 ns/op 1.5553 ns/op 1.00
fnSwitch(0) 2.1789 ns/op 2.1930 ns/op 0.99
fnObj(0) 1.5575 ns/op 1.5671 ns/op 0.99
fnArr(0) 1.5535 ns/op 1.5556 ns/op 1.00
fnIf(4) 2.1772 ns/op 2.1792 ns/op 1.00
fnSwitch(4) 2.1769 ns/op 2.1774 ns/op 1.00
fnObj(4) 1.5661 ns/op 1.5590 ns/op 1.00
fnArr(4) 1.5569 ns/op 1.5558 ns/op 1.00
fnIf(9) 3.1090 ns/op 3.1081 ns/op 1.00
fnSwitch(9) 2.1794 ns/op 2.1764 ns/op 1.00
fnObj(9) 1.5562 ns/op 1.5801 ns/op 0.98
fnArr(9) 1.5559 ns/op 1.5545 ns/op 1.00
Container {a,b,vec} - as struct x100000 124.61 us/op 124.58 us/op 1.00
Container {a,b,vec} - as tree x100000 559.71 us/op 559.68 us/op 1.00
Container {a,vec,b} - as struct x100000 155.73 us/op 155.73 us/op 1.00
Container {a,vec,b} - as tree x100000 560.16 us/op 560.01 us/op 1.00
get 2 props x1000000 - rawObject 312.17 us/op 311.39 us/op 1.00
get 2 props x1000000 - proxy 73.319 ms/op 73.097 ms/op 1.00
get 2 props x1000000 - customObj 311.47 us/op 314.00 us/op 0.99
Simple object binary -> struct 616.00 ns/op 644.00 ns/op 0.96
Simple object binary -> tree_backed 1.6600 us/op 1.7090 us/op 0.97
Simple object struct -> tree_backed 2.2490 us/op 2.2400 us/op 1.00
Simple object tree_backed -> struct 1.5520 us/op 1.5990 us/op 0.97
Simple object struct -> binary 907.00 ns/op 897.00 ns/op 1.01
Simple object tree_backed -> binary 1.2960 us/op 1.3310 us/op 0.97
aggregationBits binary -> struct 513.00 ns/op 623.00 ns/op 0.82
aggregationBits binary -> tree_backed 2.3230 us/op 2.1420 us/op 1.08
aggregationBits struct -> tree_backed 2.6680 us/op 2.5160 us/op 1.06
aggregationBits tree_backed -> struct 1.0910 us/op 938.00 ns/op 1.16
aggregationBits struct -> binary 771.00 ns/op 731.00 ns/op 1.05
aggregationBits tree_backed -> binary 967.00 ns/op 844.00 ns/op 1.15
List(uint8) 100000 binary -> struct 959.92 us/op 1.0501 ms/op 0.91
List(uint8) 100000 binary -> tree_backed 264.27 us/op 267.64 us/op 0.99
List(uint8) 100000 struct -> tree_backed 1.3656 ms/op 1.3410 ms/op 1.02
List(uint8) 100000 tree_backed -> struct 966.75 us/op 998.24 us/op 0.97
List(uint8) 100000 struct -> binary 1.0768 ms/op 1.0692 ms/op 1.01
List(uint8) 100000 tree_backed -> binary 107.66 us/op 108.12 us/op 1.00
List(uint64Number) 100000 binary -> struct 1.2991 ms/op 1.2923 ms/op 1.01
List(uint64Number) 100000 binary -> tree_backed 4.8937 ms/op 4.8386 ms/op 1.01
List(uint64Number) 100000 struct -> tree_backed 6.5296 ms/op 6.6501 ms/op 0.98
List(uint64Number) 100000 tree_backed -> struct 2.4100 ms/op 2.4660 ms/op 0.98
List(uint64Number) 100000 struct -> binary 1.4632 ms/op 1.4565 ms/op 1.00
List(uint64Number) 100000 tree_backed -> binary 1.0870 ms/op 1.0716 ms/op 1.01
List(Uint64Bigint) 100000 binary -> struct 4.0124 ms/op 3.9628 ms/op 1.01
List(Uint64Bigint) 100000 binary -> tree_backed 5.1691 ms/op 4.5365 ms/op 1.14
List(Uint64Bigint) 100000 struct -> tree_backed 7.4201 ms/op 7.3265 ms/op 1.01
List(Uint64Bigint) 100000 tree_backed -> struct 5.0058 ms/op 4.7508 ms/op 1.05
List(Uint64Bigint) 100000 struct -> binary 2.1155 ms/op 2.1112 ms/op 1.00
List(Uint64Bigint) 100000 tree_backed -> binary 1.1214 ms/op 1.1139 ms/op 1.01
Vector(Root) 100000 binary -> struct 35.463 ms/op 34.378 ms/op 1.03
Vector(Root) 100000 binary -> tree_backed 35.015 ms/op 34.819 ms/op 1.01
Vector(Root) 100000 struct -> tree_backed 50.129 ms/op 50.652 ms/op 0.99
Vector(Root) 100000 tree_backed -> struct 50.609 ms/op 48.740 ms/op 1.04
Vector(Root) 100000 struct -> binary 3.5754 ms/op 3.1117 ms/op 1.15
Vector(Root) 100000 tree_backed -> binary 6.7028 ms/op 6.7232 ms/op 1.00
List(Validator) 100000 binary -> struct 106.01 ms/op 103.22 ms/op 1.03
List(Validator) 100000 binary -> tree_backed 342.47 ms/op 327.89 ms/op 1.04
List(Validator) 100000 struct -> tree_backed 374.47 ms/op 370.68 ms/op 1.01
List(Validator) 100000 tree_backed -> struct 210.84 ms/op 209.72 ms/op 1.01
List(Validator) 100000 struct -> binary 31.450 ms/op 29.921 ms/op 1.05
List(Validator) 100000 tree_backed -> binary 110.37 ms/op 112.02 ms/op 0.99
List(Validator-NS) 100000 binary -> struct 112.16 ms/op 99.586 ms/op 1.13
List(Validator-NS) 100000 binary -> tree_backed 142.37 ms/op 140.81 ms/op 1.01
List(Validator-NS) 100000 struct -> tree_backed 189.53 ms/op 185.05 ms/op 1.02
List(Validator-NS) 100000 tree_backed -> struct 149.38 ms/op 150.59 ms/op 0.99
List(Validator-NS) 100000 struct -> binary 7.4548 ms/op 8.2149 ms/op 0.91
List(Validator-NS) 100000 tree_backed -> binary 12.358 ms/op 14.183 ms/op 0.87
get epochStatuses - MutableVector 99.130 us/op 93.648 us/op 1.06
get epochStatuses - ViewDU 211.80 us/op 206.80 us/op 1.02
set epochStatuses - ListTreeView 2.2249 ms/op 2.1710 ms/op 1.02
set epochStatuses - ListTreeView - set() 479.07 us/op 442.89 us/op 1.08
set epochStatuses - ListTreeView - commit() 829.10 us/op 812.31 us/op 1.02
bitstring 519.30 ns/op 514.97 ns/op 1.01
bit mask 13.416 ns/op 13.904 ns/op 0.96
struct - increase slot to 1000000 934.41 us/op 933.50 us/op 1.00
UintNumberType - increase slot to 1000000 28.313 ms/op 27.723 ms/op 1.02
UintBigintType - increase slot to 1000000 178.39 ms/op 186.22 ms/op 0.96
UintBigint8 x 100000 tree_deserialize 5.6771 ms/op 5.3073 ms/op 1.07
UintBigint8 x 100000 tree_serialize 1.1287 ms/op 1.1294 ms/op 1.00
UintBigint16 x 100000 tree_deserialize 6.4893 ms/op 5.7139 ms/op 1.14
UintBigint16 x 100000 tree_serialize 1.3976 ms/op 1.4070 ms/op 0.99
UintBigint32 x 100000 tree_deserialize 5.6199 ms/op 5.5974 ms/op 1.00
UintBigint32 x 100000 tree_serialize 1.8947 ms/op 1.8884 ms/op 1.00
UintBigint64 x 100000 tree_deserialize 6.0374 ms/op 6.9190 ms/op 0.87
UintBigint64 x 100000 tree_serialize 2.5686 ms/op 2.5274 ms/op 1.02
UintBigint8 x 100000 value_deserialize 409.38 us/op 405.32 us/op 1.01
UintBigint8 x 100000 value_serialize 783.97 us/op 777.78 us/op 1.01
UintBigint16 x 100000 value_deserialize 467.48 us/op 466.61 us/op 1.00
UintBigint16 x 100000 value_serialize 813.01 us/op 809.50 us/op 1.00
UintBigint32 x 100000 value_deserialize 497.46 us/op 497.61 us/op 1.00
UintBigint32 x 100000 value_serialize 851.92 us/op 853.38 us/op 1.00
UintBigint64 x 100000 value_deserialize 532.96 us/op 530.94 us/op 1.00
UintBigint64 x 100000 value_serialize 1.0072 ms/op 989.37 us/op 1.02
UintBigint8 x 100000 deserialize 3.5182 ms/op 3.2645 ms/op 1.08
UintBigint8 x 100000 serialize 1.7879 ms/op 1.5957 ms/op 1.12
UintBigint16 x 100000 deserialize 3.4465 ms/op 3.2074 ms/op 1.07
UintBigint16 x 100000 serialize 1.5209 ms/op 1.7001 ms/op 0.89
UintBigint32 x 100000 deserialize 3.6104 ms/op 3.3228 ms/op 1.09
UintBigint32 x 100000 serialize 2.9768 ms/op 2.9502 ms/op 1.01
UintBigint64 x 100000 deserialize 4.3322 ms/op 4.2054 ms/op 1.03
UintBigint64 x 100000 serialize 1.6747 ms/op 1.6543 ms/op 1.01
UintBigint128 x 100000 deserialize 5.9551 ms/op 5.7743 ms/op 1.03
UintBigint128 x 100000 serialize 16.047 ms/op 16.279 ms/op 0.99
UintBigint256 x 100000 deserialize 8.9941 ms/op 8.8750 ms/op 1.01
UintBigint256 x 100000 serialize 45.143 ms/op 45.077 ms/op 1.00
Slice from Uint8Array x25000 1.4051 ms/op 1.4579 ms/op 0.96
Slice from ArrayBuffer x25000 16.395 ms/op 16.124 ms/op 1.02
Slice from ArrayBuffer x25000 + new Uint8Array 18.111 ms/op 17.611 ms/op 1.03
Copy Uint8Array 100000 iterate 1.7685 ms/op 1.7605 ms/op 1.00
Copy Uint8Array 100000 slice 111.56 us/op 113.74 us/op 0.98
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 108.02 us/op 113.47 us/op 0.95
Copy Buffer 100000 Uint8Array.prototype.slice.call 112.48 us/op 115.07 us/op 0.98
Copy Uint8Array 100000 slice + set 208.87 us/op 227.26 us/op 0.92
Copy Uint8Array 100000 subarray + set 105.75 us/op 113.85 us/op 0.93
Copy Uint8Array 100000 slice arrayBuffer 109.86 us/op 115.94 us/op 0.95
Uint64 deserialize 100000 - iterate Uint8Array 2.0552 ms/op 1.9938 ms/op 1.03
Uint64 deserialize 100000 - by Uint32A 1.9233 ms/op 1.8799 ms/op 1.02
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.9534 ms/op 1.9750 ms/op 0.99
Uint64 deserialize 100000 - by DataView.getBigUint64 5.2304 ms/op 4.9976 ms/op 1.05
Uint64 deserialize 100000 - by byte 40.301 ms/op 40.278 ms/op 1.00

by benchmarkbot/action

wemeetagain pushed a commit that referenced this pull request Nov 22, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.3.0](ssz-v1.2.2...ssz-v1.3.0)
(2025-11-22)


### Features

* add reuseBytes option to deserialize
([#503](#503))
([b1e55bc](b1e55bc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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