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: hashInto() and digest64Into() api #480

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Mar 27, 2025

Motivation

  • we have inefficient executeHashComputations() on Linux but have no idea how much overhead of this function

Description

  • add more benchmarks to compare how much batch hash is better for each hasher
  • the hashInto() is not comparable to digest64() because digest64() causes memory allocation, so I implemented *Into() apis to make a fair comparison
  • for some scenarios in lodestar, it's better to use "*Into" apis

part of #479

@twoeths twoeths marked this pull request as ready for review March 27, 2025 08:02
@twoeths twoeths requested a review from a team as a code owner March 27, 2025 08:02
Copy link

github-actions bot commented Mar 27, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 93cfccd Previous: ce3e37f Ratio
digestTwoHashObjects 50023 times 48.642 ms/op 48.212 ms/op 1.01
digest2Bytes32 50023 times 55.398 ms/op 54.544 ms/op 1.02
digest 50023 times 53.598 ms/op 53.185 ms/op 1.01
input length 32 1.1830 us/op 1.1670 us/op 1.01
input length 64 1.3510 us/op 1.3310 us/op 1.02
input length 128 2.2780 us/op 2.2480 us/op 1.01
input length 256 3.3620 us/op 3.4880 us/op 0.96
input length 512 5.5310 us/op 5.5710 us/op 0.99
input length 1024 10.798 us/op 10.806 us/op 1.00
digest 1000000 times 849.96 ms/op 848.25 ms/op 1.00
hashObjectToByteArray 50023 times 935.98 us/op 936.38 us/op 1.00
byteArrayToHashObject 50023 times 1.3084 ms/op 1.3519 ms/op 0.97
digest64 200092 times 213.73 ms/op 214.48 ms/op 1.00
hash 200092 times using batchHash4UintArray64s 245.59 ms/op 235.13 ms/op 1.04
digest64HashObjects 200092 times 192.87 ms/op 192.60 ms/op 1.00
hash 200092 times using batchHash4HashObjectInputs 201.97 ms/op 202.32 ms/op 1.00
getGindicesAtDepth 3.3640 us/op 3.4290 us/op 0.98
iterateAtDepth 6.2520 us/op 6.2440 us/op 1.00
getGindexBits 398.00 ns/op 376.00 ns/op 1.06
gindexIterator 846.00 ns/op 842.00 ns/op 1.00
HashComputationLevel.push then loop 27.766 ms/op 27.148 ms/op 1.02
HashComputation[] push then loop 50.428 ms/op 48.061 ms/op 1.05
hash 2 32 bytes Uint8Array 500000 times - hashtree 182.90 ms/op
batch hash 16 x 64 Uint8Array 31250 times - hashtree 26.690 ms/op
hashTwoObjects 500000 times - hashtree 207.96 ms/op 211.62 ms/op 0.98
executeHashComputations - hashtree 9.4100 ms/op 9.5945 ms/op 0.98
hash 2 32 bytes Uint8Array 500000 times - as-sha256 494.35 ms/op
batch hash 16 x 64 Uint8Array 31250 times - as-sha256 556.46 ms/op
hashTwoObjects 500000 times - as-sha256 508.88 ms/op 506.36 ms/op 1.00
executeHashComputations - as-sha256 43.526 ms/op 47.018 ms/op 0.93
hash 2 32 bytes Uint8Array 500000 times - noble 1.3055 s/op
batch hash 16 x 64 Uint8Array 31250 times - noble 1.2278 s/op
hashTwoObjects 500000 times - noble 1.5787 s/op 1.8830 s/op 0.84
executeHashComputations - noble 36.120 ms/op 38.993 ms/op 0.93
getHashComputations 3.1141 ms/op 2.7090 ms/op 1.15
executeHashComputations 10.361 ms/op 9.9682 ms/op 1.04
get root 14.940 ms/op 15.295 ms/op 0.98
getNodeH() x7812.5 avg hindex 12.237 us/op 12.391 us/op 0.99
getNodeH() x7812.5 index 0 7.5860 us/op 7.7110 us/op 0.98
getNodeH() x7812.5 index 7 7.8170 us/op 7.5650 us/op 1.03
getNodeH() x7812.5 index 7 with key array 6.3920 us/op 6.3990 us/op 1.00
new LeafNode() x7812.5 305.34 us/op 355.83 us/op 0.86
getHashComputations 250000 nodes 16.388 ms/op 15.395 ms/op 1.06
batchHash 250000 nodes 87.796 ms/op 89.027 ms/op 0.99
get root 250000 nodes 113.44 ms/op 116.26 ms/op 0.98
getHashComputations 500000 nodes 30.937 ms/op 44.109 ms/op 0.70
batchHash 500000 nodes 160.91 ms/op 171.14 ms/op 0.94
get root 500000 nodes 235.95 ms/op 229.19 ms/op 1.03
getHashComputations 1000000 nodes 56.077 ms/op 94.074 ms/op 0.60
batchHash 1000000 nodes 373.15 ms/op 337.06 ms/op 1.11
get root 1000000 nodes 448.87 ms/op 457.31 ms/op 0.98
multiproof - depth 15, 1 requested leaves 9.6630 us/op 7.8290 us/op 1.23
tree offset multiproof - depth 15, 1 requested leaves 21.179 us/op 17.188 us/op 1.23
compact multiproof - depth 15, 1 requested leaves 3.4770 us/op 2.9780 us/op 1.17
multiproof - depth 15, 2 requested leaves 12.537 us/op 12.125 us/op 1.03
tree offset multiproof - depth 15, 2 requested leaves 23.769 us/op 21.754 us/op 1.09
compact multiproof - depth 15, 2 requested leaves 3.6010 us/op 3.0790 us/op 1.17
multiproof - depth 15, 3 requested leaves 17.933 us/op 16.028 us/op 1.12
tree offset multiproof - depth 15, 3 requested leaves 30.017 us/op 27.390 us/op 1.10
compact multiproof - depth 15, 3 requested leaves 5.1100 us/op 3.7610 us/op 1.36
multiproof - depth 15, 4 requested leaves 25.199 us/op 21.491 us/op 1.17
tree offset multiproof - depth 15, 4 requested leaves 36.441 us/op 34.123 us/op 1.07
compact multiproof - depth 15, 4 requested leaves 6.4310 us/op 4.9620 us/op 1.30
packedRootsBytesToLeafNodes bytes 4000 offset 0 6.6540 us/op 5.7300 us/op 1.16
packedRootsBytesToLeafNodes bytes 4000 offset 1 6.9290 us/op 6.1480 us/op 1.13
packedRootsBytesToLeafNodes bytes 4000 offset 2 6.7110 us/op 5.8070 us/op 1.16
packedRootsBytesToLeafNodes bytes 4000 offset 3 6.8430 us/op 5.6720 us/op 1.21
subtreeFillToContents depth 40 count 250000 51.780 ms/op 50.768 ms/op 1.02
setRoot - gindexBitstring 20.459 ms/op 22.563 ms/op 0.91
setRoot - gindex 20.004 ms/op 25.576 ms/op 0.78
getRoot - gindexBitstring 2.4893 ms/op 2.7629 ms/op 0.90
getRoot - gindex 2.9823 ms/op 3.4687 ms/op 0.86
getHashObject then setHashObject 20.621 ms/op 22.313 ms/op 0.92
setNodeWithFn 19.001 ms/op 20.194 ms/op 0.94
getNodeAtDepth depth 0 x100000 280.02 us/op 282.94 us/op 0.99
setNodeAtDepth depth 0 x100000 2.2289 ms/op 2.6822 ms/op 0.83
getNodesAtDepth depth 0 x100000 313.44 us/op 315.04 us/op 0.99
setNodesAtDepth depth 0 x100000 753.97 us/op 755.69 us/op 1.00
getNodeAtDepth depth 1 x100000 343.75 us/op 342.17 us/op 1.00
setNodeAtDepth depth 1 x100000 7.3941 ms/op 10.176 ms/op 0.73
getNodesAtDepth depth 1 x100000 442.09 us/op 436.14 us/op 1.01
setNodesAtDepth depth 1 x100000 6.5203 ms/op 6.9374 ms/op 0.94
getNodeAtDepth depth 2 x100000 737.12 us/op 883.02 us/op 0.83
setNodeAtDepth depth 2 x100000 15.083 ms/op 17.056 ms/op 0.88
getNodesAtDepth depth 2 x100000 19.641 ms/op 20.989 ms/op 0.94
setNodesAtDepth depth 2 x100000 22.246 ms/op 26.236 ms/op 0.85
tree.getNodesAtDepth - gindexes 8.3493 ms/op 10.381 ms/op 0.80
tree.getNodesAtDepth - push all nodes 1.8625 ms/op 2.6393 ms/op 0.71
tree.getNodesAtDepth - navigation 311.94 us/op 311.62 us/op 1.00
tree.setNodesAtDepth - indexes 690.85 us/op 840.01 us/op 0.82
set at depth 8 766.00 ns/op 1.0260 us/op 0.75
set at depth 16 1.1410 us/op 1.5210 us/op 0.75
set at depth 32 1.9280 us/op 2.5870 us/op 0.75
iterateNodesAtDepth 8 256 13.769 us/op 16.743 us/op 0.82
getNodesAtDepth 8 256 3.7700 us/op 4.2710 us/op 0.88
iterateNodesAtDepth 16 65536 4.4352 ms/op 5.0857 ms/op 0.87
getNodesAtDepth 16 65536 1.5847 ms/op 2.0800 ms/op 0.76
iterateNodesAtDepth 32 250000 16.083 ms/op 17.481 ms/op 0.92
getNodesAtDepth 32 250000 4.6133 ms/op 6.6962 ms/op 0.69
iterateNodesAtDepth 40 250000 16.203 ms/op 16.297 ms/op 0.99
getNodesAtDepth 40 250000 4.4772 ms/op 4.8673 ms/op 0.92
250000 validators root getter 117.33 ms/op 114.29 ms/op 1.03
250000 validators batchHash() 100.35 ms/op 90.599 ms/op 1.11
250000 validators hashComputations 21.377 ms/op 19.144 ms/op 1.12
bitlist bytes to struct (120,90) 861.00 ns/op 612.00 ns/op 1.41
bitlist bytes to tree (120,90) 3.3540 us/op 2.3500 us/op 1.43
bitlist bytes to struct (2048,2048) 1.2780 us/op 976.00 ns/op 1.31
bitlist bytes to tree (2048,2048) 4.2110 us/op 3.8070 us/op 1.11
ByteListType - deserialize 8.0664 ms/op 7.7831 ms/op 1.04
BasicListType - deserialize 15.099 ms/op 12.415 ms/op 1.22
ByteListType - serialize 7.6803 ms/op 7.5398 ms/op 1.02
BasicListType - serialize 10.065 ms/op 9.4363 ms/op 1.07
BasicListType - tree_convertToStruct 28.080 ms/op 24.555 ms/op 1.14
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.1901 ms/op 4.7689 ms/op 1.09
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.3786 ms/op 4.3829 ms/op 1.00
Array.push len 300000 empty Array - number 7.4195 ms/op 7.1602 ms/op 1.04
Array.set len 300000 from new Array - number 2.0546 ms/op 1.7545 ms/op 1.17
Array.set len 300000 - number 6.6520 ms/op 6.2768 ms/op 1.06
Uint8Array.set len 300000 398.76 us/op 389.11 us/op 1.02
Uint32Array.set len 300000 505.92 us/op 469.01 us/op 1.08
Container({a: uint8, b: uint8}) getViewDU x300000 32.270 ms/op 29.620 ms/op 1.09
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.441 ms/op 11.180 ms/op 1.11
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 218.07 ms/op 223.86 ms/op 0.97
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 274.75 ms/op 290.51 ms/op 0.95
List(Container) len 300000 ViewDU.get(i) 7.1054 ms/op 7.0111 ms/op 1.01
List(Container) len 300000 ViewDU.getReadonly(i) 6.8789 ms/op 6.9332 ms/op 0.99
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 41.704 ms/op 40.184 ms/op 1.04
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.5357 ms/op 6.3966 ms/op 0.87
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.6290 ms/op 6.8103 ms/op 0.97
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.7426 ms/op 7.7796 ms/op 0.87
Array.push len 300000 empty Array - object 6.8841 ms/op 6.9480 ms/op 0.99
Array.set len 300000 from new Array - object 1.9583 ms/op 2.2819 ms/op 0.86
Array.set len 300000 - object 6.6453 ms/op 6.8525 ms/op 0.97
cachePermanentRootStruct no cache 3.5470 us/op 3.5250 us/op 1.01
cachePermanentRootStruct with cache 240.00 ns/op 270.00 ns/op 0.89
epochParticipation len 250000 rws 7813 2.3723 ms/op 2.7119 ms/op 0.87
Deneb BeaconBlock.hashTreeRoot(), numTransaction=200 5.5453 ms/op 5.7541 ms/op 0.96
BeaconState ViewDU batchHashTreeRoot vc=200000 mod=100000 235.21 ms/op 243.14 ms/op 0.97
BeaconState ViewDU batchHashTreeRoot - commit step vc=200000 mod=100000 199.55 ms/op 203.71 ms/op 0.98
BeaconState ViewDU batchHashTreeRoot - hash step vc=200000 mod=100000 47.019 ms/op 49.718 ms/op 0.95
BeaconState ViewDU hashTreeRoot() vc=200000 mod=100000 788.56 ms/op 814.91 ms/op 0.97
BeaconState ViewDU hashTreeRoot - commit step vc=200000 mod=100000 68.606 ms/op 74.174 ms/op 0.92
BeaconState ViewDU hashTreeRoot - validator tree creation vc=100000 mod=100000 289.53 ms/op 288.97 ms/op 1.00
deserialize Attestation - tree 3.9580 us/op 4.5220 us/op 0.88
deserialize Attestation - struct 1.9680 us/op 2.4520 us/op 0.80
deserialize SignedAggregateAndProof - tree 5.2840 us/op 6.1600 us/op 0.86
deserialize SignedAggregateAndProof - struct 3.2430 us/op 4.0410 us/op 0.80
deserialize SyncCommitteeMessage - tree 1.3590 us/op 1.7640 us/op 0.77
deserialize SyncCommitteeMessage - struct 1.1740 us/op 1.4100 us/op 0.83
deserialize SignedContributionAndProof - tree 2.8950 us/op 3.6990 us/op 0.78
deserialize SignedContributionAndProof - struct 2.4920 us/op 3.1150 us/op 0.80
deserialize SignedBeaconBlock - tree 308.05 us/op 357.54 us/op 0.86
deserialize SignedBeaconBlock - struct 130.32 us/op 157.15 us/op 0.83
BeaconState vc 300000 - deserialize tree 659.01 ms/op 736.03 ms/op 0.90
BeaconState vc 300000 - serialize tree 101.12 ms/op 97.386 ms/op 1.04
BeaconState.historicalRoots vc 300000 - deserialize tree 1.0650 us/op 1.0210 us/op 1.04
BeaconState.historicalRoots vc 300000 - serialize tree 748.00 ns/op 877.00 ns/op 0.85
BeaconState.validators vc 300000 - deserialize tree 659.24 ms/op 684.09 ms/op 0.96
BeaconState.validators vc 300000 - serialize tree 70.259 ms/op 59.766 ms/op 1.18
BeaconState.balances vc 300000 - deserialize tree 28.340 ms/op 29.242 ms/op 0.97
BeaconState.balances vc 300000 - serialize tree 5.2134 ms/op 10.188 ms/op 0.51
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 1.0999 ms/op 1.4198 ms/op 0.77
BeaconState.previousEpochParticipation vc 300000 - serialize tree 333.40 us/op 346.31 us/op 0.96
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 1.0901 ms/op 1.4362 ms/op 0.76
BeaconState.currentEpochParticipation vc 300000 - serialize tree 336.00 us/op 352.90 us/op 0.95
BeaconState.inactivityScores vc 300000 - deserialize tree 26.923 ms/op 30.178 ms/op 0.89
BeaconState.inactivityScores vc 300000 - serialize tree 4.3816 ms/op 6.5716 ms/op 0.67
hashTreeRoot Attestation - struct 12.796 us/op 17.196 us/op 0.74
hashTreeRoot Attestation - tree 8.9230 us/op 9.0910 us/op 0.98
hashTreeRoot SignedAggregateAndProof - struct 16.087 us/op 18.811 us/op 0.86
hashTreeRoot SignedAggregateAndProof - tree 13.218 us/op 13.538 us/op 0.98
hashTreeRoot SyncCommitteeMessage - struct 4.0440 us/op 4.2680 us/op 0.95
hashTreeRoot SyncCommitteeMessage - tree 3.2140 us/op 3.8500 us/op 0.83
hashTreeRoot SignedContributionAndProof - struct 9.4070 us/op 10.108 us/op 0.93
hashTreeRoot SignedContributionAndProof - tree 9.1560 us/op 9.1520 us/op 1.00
hashTreeRoot SignedBeaconBlock - struct 818.19 us/op 806.96 us/op 1.01
hashTreeRoot SignedBeaconBlock - tree 794.14 us/op 814.69 us/op 0.97
hashTreeRoot Validator - struct 4.7710 us/op 5.1540 us/op 0.93
hashTreeRoot Validator - tree 6.6590 us/op 7.5570 us/op 0.88
BeaconState vc 300000 - hashTreeRoot tree 2.2322 s/op 2.3603 s/op 0.95
BeaconState vc 300000 - batchHashTreeRoot tree 4.2014 s/op 4.4013 s/op 0.95
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.0870 us/op 1.1060 us/op 0.98
BeaconState.validators vc 300000 - hashTreeRoot tree 2.5100 s/op 2.5207 s/op 1.00
BeaconState.balances vc 300000 - hashTreeRoot tree 34.232 ms/op 34.469 ms/op 0.99
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 4.2044 ms/op 4.2152 ms/op 1.00
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 4.1943 ms/op 4.2394 ms/op 0.99
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 34.820 ms/op 34.675 ms/op 1.00
hash64 x18 9.6090 us/op 9.7690 us/op 0.98
hashTwoObjects x18 7.8210 us/op 8.4630 us/op 0.92
hash64 x1740 886.71 us/op 898.14 us/op 0.99
hashTwoObjects x1740 719.87 us/op 746.55 us/op 0.96
hash64 x2700000 1.3820 s/op 1.4166 s/op 0.98
hashTwoObjects x2700000 1.1147 s/op 1.1638 s/op 0.96
get_exitEpoch - ContainerType 340.00 ns/op 342.00 ns/op 0.99
get_exitEpoch - ContainerNodeStructType 348.00 ns/op 345.00 ns/op 1.01
set_exitEpoch - ContainerType 365.00 ns/op 342.00 ns/op 1.07
set_exitEpoch - ContainerNodeStructType 337.00 ns/op 341.00 ns/op 0.99
get_pubkey - ContainerType 1.2240 us/op 1.2790 us/op 0.96
get_pubkey - ContainerNodeStructType 322.00 ns/op 331.00 ns/op 0.97
hashTreeRoot - ContainerType 552.00 ns/op 510.00 ns/op 1.08
hashTreeRoot - ContainerNodeStructType 533.00 ns/op 517.00 ns/op 1.03
createProof - ContainerType 4.7930 us/op 5.0610 us/op 0.95
createProof - ContainerNodeStructType 25.095 us/op 27.313 us/op 0.92
serialize - ContainerType 1.9990 us/op 2.1290 us/op 0.94
serialize - ContainerNodeStructType 1.4270 us/op 1.6150 us/op 0.88
set_exitEpoch_and_hashTreeRoot - ContainerType 3.5860 us/op 3.5650 us/op 1.01
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 7.4460 us/op 7.5620 us/op 0.98
doBatchHashTreeRootValidators 4.0860 us/op 3.9720 us/op 1.03
ContainerNodeStructViewDU hashTreeRoot 25.691 us/op 26.434 us/op 0.97
Array - for of 5.5710 us/op 8.0960 us/op 0.69
Array - for(;;) 5.6010 us/op 8.1510 us/op 0.69
basicListValue.readonlyValuesArray() 4.3831 ms/op 4.5971 ms/op 0.95
basicListValue.readonlyValuesArray() + loop all 5.9573 ms/op 4.8348 ms/op 1.23
compositeListValue.readonlyValuesArray() 33.588 ms/op 38.866 ms/op 0.86
compositeListValue.readonlyValuesArray() + loop all 34.169 ms/op 32.731 ms/op 1.04
Number64UintType - get balances list 5.0220 ms/op 4.6536 ms/op 1.08
Number64UintType - set balances list 10.147 ms/op 11.125 ms/op 0.91
Number64UintType - get and increase 10 then set 44.167 ms/op 44.920 ms/op 0.98
Number64UintType - increase 10 using applyDelta 17.855 ms/op 18.459 ms/op 0.97
Number64UintType - increase 10 using applyDeltaInBatch 18.090 ms/op 18.469 ms/op 0.98
tree_newTreeFromUint64Deltas 24.045 ms/op 24.285 ms/op 0.99
unsafeUint8ArrayToTree 41.173 ms/op 41.333 ms/op 1.00
bitLength(50) 302.00 ns/op 311.00 ns/op 0.97
bitLengthStr(50) 276.00 ns/op 264.00 ns/op 1.05
bitLength(8000) 300.00 ns/op 322.00 ns/op 0.93
bitLengthStr(8000) 305.00 ns/op 296.00 ns/op 1.03
bitLength(250000) 300.00 ns/op 300.00 ns/op 1.00
bitLengthStr(250000) 356.00 ns/op 338.00 ns/op 1.05
merkleize 32 chunks 16.101 us/op 15.904 us/op 1.01
merkleizeBlocksBytes 32 chunks 3.5880 us/op 3.5550 us/op 1.01
merkleizeBlockArray 32 chunks 7.0620 us/op 6.9370 us/op 1.02
merkleize 128 chunks 64.826 us/op 63.290 us/op 1.02
merkleizeBlocksBytes 128 chunks 7.8860 us/op 7.7810 us/op 1.01
merkleizeBlockArray 128 chunks 19.428 us/op 19.532 us/op 0.99
merkleize 512 chunks 255.07 us/op 252.54 us/op 1.01
merkleizeBlocksBytes 512 chunks 23.322 us/op 22.995 us/op 1.01
merkleizeBlockArray 512 chunks 66.845 us/op 66.347 us/op 1.01
merkleize 1024 chunks 505.20 us/op 506.96 us/op 1.00
merkleizeBlocksBytes 1024 chunks 44.116 us/op 43.018 us/op 1.03
merkleizeBlockArray 1024 chunks 130.93 us/op 130.16 us/op 1.01
floor - Math.floor (53) 1.2441 ns/op 1.2458 ns/op 1.00
floor - << 0 (53) 1.2430 ns/op 1.2433 ns/op 1.00
floor - Math.floor (512) 1.2433 ns/op 1.2439 ns/op 1.00
floor - << 0 (512) 1.2437 ns/op 1.2452 ns/op 1.00
fnIf(0) 1.5591 ns/op 1.5567 ns/op 1.00
fnSwitch(0) 2.1759 ns/op 2.1779 ns/op 1.00
fnObj(0) 1.5653 ns/op 1.5608 ns/op 1.00
fnArr(0) 1.5544 ns/op 1.5617 ns/op 1.00
fnIf(4) 2.1800 ns/op 2.1793 ns/op 1.00
fnSwitch(4) 2.2037 ns/op 2.1784 ns/op 1.01
fnObj(4) 1.5649 ns/op 1.5749 ns/op 0.99
fnArr(4) 1.5548 ns/op 1.5699 ns/op 0.99
fnIf(9) 3.1117 ns/op 3.1401 ns/op 0.99
fnSwitch(9) 2.1814 ns/op 2.2166 ns/op 0.98
fnObj(9) 1.5622 ns/op 1.5548 ns/op 1.00
fnArr(9) 1.5541 ns/op 1.5600 ns/op 1.00
Container {a,b,vec} - as struct x100000 124.79 us/op 124.55 us/op 1.00
Container {a,b,vec} - as tree x100000 559.51 us/op 560.57 us/op 1.00
Container {a,vec,b} - as struct x100000 155.66 us/op 155.66 us/op 1.00
Container {a,vec,b} - as tree x100000 560.14 us/op 560.38 us/op 1.00
get 2 props x1000000 - rawObject 311.20 us/op 311.75 us/op 1.00
get 2 props x1000000 - proxy 74.182 ms/op 73.123 ms/op 1.01
get 2 props x1000000 - customObj 311.07 us/op 311.29 us/op 1.00
Simple object binary -> struct 932.00 ns/op 1.2370 us/op 0.75
Simple object binary -> tree_backed 2.1420 us/op 3.2760 us/op 0.65
Simple object struct -> tree_backed 3.0370 us/op 3.9240 us/op 0.77
Simple object tree_backed -> struct 2.1340 us/op 4.1000 us/op 0.52
Simple object struct -> binary 1.0800 us/op 1.2350 us/op 0.87
Simple object tree_backed -> binary 1.8590 us/op 1.7270 us/op 1.08
aggregationBits binary -> struct 726.00 ns/op 697.00 ns/op 1.04
aggregationBits binary -> tree_backed 3.1340 us/op 2.9880 us/op 1.05
aggregationBits struct -> tree_backed 3.5090 us/op 3.2300 us/op 1.09
aggregationBits tree_backed -> struct 1.4300 us/op 1.3140 us/op 1.09
aggregationBits struct -> binary 922.00 ns/op 861.00 ns/op 1.07
aggregationBits tree_backed -> binary 1.3180 us/op 1.1420 us/op 1.15
List(uint8) 100000 binary -> struct 1.8336 ms/op 1.8973 ms/op 0.97
List(uint8) 100000 binary -> tree_backed 365.65 us/op 324.33 us/op 1.13
List(uint8) 100000 struct -> tree_backed 1.4359 ms/op 1.4499 ms/op 0.99
List(uint8) 100000 tree_backed -> struct 1.1920 ms/op 1.2293 ms/op 0.97
List(uint8) 100000 struct -> binary 1.1114 ms/op 1.0732 ms/op 1.04
List(uint8) 100000 tree_backed -> binary 108.97 us/op 110.08 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.4525 ms/op 1.4652 ms/op 0.99
List(uint64Number) 100000 binary -> tree_backed 5.2281 ms/op 5.0945 ms/op 1.03
List(uint64Number) 100000 struct -> tree_backed 7.2107 ms/op 7.3457 ms/op 0.98
List(uint64Number) 100000 tree_backed -> struct 3.2734 ms/op 2.9495 ms/op 1.11
List(uint64Number) 100000 struct -> binary 1.5240 ms/op 1.4812 ms/op 1.03
List(uint64Number) 100000 tree_backed -> binary 2.1297 ms/op 2.1395 ms/op 1.00
List(Uint64Bigint) 100000 binary -> struct 4.4900 ms/op 4.0568 ms/op 1.11
List(Uint64Bigint) 100000 binary -> tree_backed 5.2435 ms/op 5.8599 ms/op 0.89
List(Uint64Bigint) 100000 struct -> tree_backed 7.6461 ms/op 8.2299 ms/op 0.93
List(Uint64Bigint) 100000 tree_backed -> struct 5.7518 ms/op 5.4613 ms/op 1.05
List(Uint64Bigint) 100000 struct -> binary 2.0898 ms/op 2.1284 ms/op 0.98
List(Uint64Bigint) 100000 tree_backed -> binary 1.4589 ms/op 1.1773 ms/op 1.24
Vector(Root) 100000 binary -> struct 39.467 ms/op 41.302 ms/op 0.96
Vector(Root) 100000 binary -> tree_backed 45.089 ms/op 40.953 ms/op 1.10
Vector(Root) 100000 struct -> tree_backed 54.518 ms/op 56.503 ms/op 0.96
Vector(Root) 100000 tree_backed -> struct 53.277 ms/op 56.677 ms/op 0.94
Vector(Root) 100000 struct -> binary 3.1113 ms/op 3.3127 ms/op 0.94
Vector(Root) 100000 tree_backed -> binary 6.0299 ms/op 7.1612 ms/op 0.84
List(Validator) 100000 binary -> struct 130.99 ms/op 108.84 ms/op 1.20
List(Validator) 100000 binary -> tree_backed 384.38 ms/op 393.44 ms/op 0.98
List(Validator) 100000 struct -> tree_backed 403.86 ms/op 416.15 ms/op 0.97
List(Validator) 100000 tree_backed -> struct 223.40 ms/op 226.70 ms/op 0.99
List(Validator) 100000 struct -> binary 32.928 ms/op 30.169 ms/op 1.09
List(Validator) 100000 tree_backed -> binary 113.21 ms/op 112.93 ms/op 1.00
List(Validator-NS) 100000 binary -> struct 107.62 ms/op 107.79 ms/op 1.00
List(Validator-NS) 100000 binary -> tree_backed 177.16 ms/op 170.85 ms/op 1.04
List(Validator-NS) 100000 struct -> tree_backed 201.36 ms/op 198.53 ms/op 1.01
List(Validator-NS) 100000 tree_backed -> struct 156.83 ms/op 156.75 ms/op 1.00
List(Validator-NS) 100000 struct -> binary 7.7634 ms/op 8.7497 ms/op 0.89
List(Validator-NS) 100000 tree_backed -> binary 14.100 ms/op 14.024 ms/op 1.01
get epochStatuses - MutableVector 98.416 us/op 104.98 us/op 0.94
get epochStatuses - ViewDU 213.94 us/op 211.85 us/op 1.01
set epochStatuses - ListTreeView 2.3383 ms/op 2.2536 ms/op 1.04
set epochStatuses - ListTreeView - set() 469.10 us/op 448.42 us/op 1.05
set epochStatuses - ListTreeView - commit() 767.53 us/op 759.46 us/op 1.01
bitstring 524.38 ns/op 519.82 ns/op 1.01
bit mask 13.291 ns/op 14.485 ns/op 0.92
struct - increase slot to 1000000 932.66 us/op 933.65 us/op 1.00
UintNumberType - increase slot to 1000000 26.452 ms/op 27.714 ms/op 0.95
UintBigintType - increase slot to 1000000 221.47 ms/op 181.48 ms/op 1.22
UintBigint8 x 100000 tree_deserialize 7.2939 ms/op 5.7778 ms/op 1.26
UintBigint8 x 100000 tree_serialize 1.1286 ms/op 1.1294 ms/op 1.00
UintBigint16 x 100000 tree_deserialize 6.2451 ms/op 5.8593 ms/op 1.07
UintBigint16 x 100000 tree_serialize 1.9518 ms/op 1.4749 ms/op 1.32
UintBigint32 x 100000 tree_deserialize 7.6231 ms/op 5.8836 ms/op 1.30
UintBigint32 x 100000 tree_serialize 2.3453 ms/op 1.9691 ms/op 1.19
UintBigint64 x 100000 tree_deserialize 7.8605 ms/op 7.8983 ms/op 1.00
UintBigint64 x 100000 tree_serialize 2.9512 ms/op 2.6324 ms/op 1.12
UintBigint8 x 100000 value_deserialize 408.95 us/op 404.32 us/op 1.01
UintBigint8 x 100000 value_serialize 1.3449 ms/op 799.58 us/op 1.68
UintBigint16 x 100000 value_deserialize 467.08 us/op 467.70 us/op 1.00
UintBigint16 x 100000 value_serialize 1.3083 ms/op 827.50 us/op 1.58
UintBigint32 x 100000 value_deserialize 496.63 us/op 499.37 us/op 0.99
UintBigint32 x 100000 value_serialize 1.2748 ms/op 886.20 us/op 1.44
UintBigint64 x 100000 value_deserialize 531.50 us/op 530.67 us/op 1.00
UintBigint64 x 100000 value_serialize 1.6081 ms/op 1.0852 ms/op 1.48
UintBigint8 x 100000 deserialize 4.1912 ms/op 3.7919 ms/op 1.11
UintBigint8 x 100000 serialize 1.5799 ms/op 1.6356 ms/op 0.97
UintBigint16 x 100000 deserialize 4.1505 ms/op 3.8988 ms/op 1.06
UintBigint16 x 100000 serialize 1.6487 ms/op 1.5761 ms/op 1.05
UintBigint32 x 100000 deserialize 4.0975 ms/op 3.8183 ms/op 1.07
UintBigint32 x 100000 serialize 3.2354 ms/op 3.0873 ms/op 1.05
UintBigint64 x 100000 deserialize 4.6964 ms/op 4.5166 ms/op 1.04
UintBigint64 x 100000 serialize 1.6903 ms/op 1.7128 ms/op 0.99
UintBigint128 x 100000 deserialize 6.9419 ms/op 6.7019 ms/op 1.04
UintBigint128 x 100000 serialize 15.330 ms/op 16.949 ms/op 0.90
UintBigint256 x 100000 deserialize 8.7287 ms/op 10.185 ms/op 0.86
UintBigint256 x 100000 serialize 45.110 ms/op 46.172 ms/op 0.98
Slice from Uint8Array x25000 1.5606 ms/op 1.5016 ms/op 1.04
Slice from ArrayBuffer x25000 16.888 ms/op 17.057 ms/op 0.99
Slice from ArrayBuffer x25000 + new Uint8Array 19.044 ms/op 18.270 ms/op 1.04
Copy Uint8Array 100000 iterate 1.7084 ms/op 1.7855 ms/op 0.96
Copy Uint8Array 100000 slice 134.39 us/op 120.14 us/op 1.12
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 133.82 us/op 121.42 us/op 1.10
Copy Buffer 100000 Uint8Array.prototype.slice.call 132.47 us/op 124.36 us/op 1.07
Copy Uint8Array 100000 slice + set 262.22 us/op 248.76 us/op 1.05
Copy Uint8Array 100000 subarray + set 138.23 us/op 124.78 us/op 1.11
Copy Uint8Array 100000 slice arrayBuffer 139.72 us/op 128.89 us/op 1.08
Uint64 deserialize 100000 - iterate Uint8Array 2.2405 ms/op 2.2128 ms/op 1.01
Uint64 deserialize 100000 - by Uint32A 2.1926 ms/op 2.2675 ms/op 0.97
Uint64 deserialize 100000 - by DataView.getUint32 x2 2.1222 ms/op 1.9938 ms/op 1.06
Uint64 deserialize 100000 - by DataView.getBigUint64 5.3412 ms/op 5.1154 ms/op 1.04
Uint64 deserialize 100000 - by byte 40.745 ms/op 40.505 ms/op 1.01

by benchmarkbot/action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant