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!: implement hashInto() api for as-sha256 #382

Merged
merged 3 commits into from
Jul 16, 2024
Merged

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jul 14, 2024

Motivation

The hashInto() api of hashtree is very efficient in terms of memory allocation for the consumer because they can preallocate output and reuse over multiple hashes, they can also hash into the same input Uint8Array

Description

  • implement hashInto() api with the same interface to hashtree
  • implement digest64HashObjectsInto() which is similar to digest64HashObjects() but this does not allocate new HashObject
  • implement byteArrayIntoHashObject() which is similar to byteArrayToHashObject(), but this does not allocate new HashObject

all of these functions are used by persistent-merkle-tree and ssz in upcoming PRs

BREAKING CHANGE

  • add offset param to byteArrayToHashObject() so that consumer can use the same big Uint8Array to extract HashObject from a subsection of it without using subarray()

part of #378

@twoeths twoeths changed the title feat: implement hashInto() api for as-sha256 feat!: implement hashInto() api for as-sha256 Jul 14, 2024
@twoeths twoeths marked this pull request as ready for review July 14, 2024 07:48
@twoeths twoeths requested a review from a team as a code owner July 14, 2024 07:48
Copy link

github-actions bot commented Jul 14, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: fdca905 Previous: ec123ec Ratio
digestTwoHashObjects 50023 times 48.271 ms/op 48.074 ms/op 1.00
digest64 50023 times 51.241 ms/op 51.160 ms/op 1.00
digest 50023 times 52.887 ms/op 52.531 ms/op 1.01
input length 32 1.1910 us/op 1.1960 us/op 1.00
input length 64 1.3590 us/op 1.3590 us/op 1.00
input length 128 2.2920 us/op 2.3300 us/op 0.98
input length 256 3.3820 us/op 3.3610 us/op 1.01
input length 512 5.8120 us/op 5.5660 us/op 1.04
input length 1024 11.000 us/op 10.753 us/op 1.02
digest 1000000 times 829.42 ms/op 808.93 ms/op 1.03
hashObjectToByteArray 50023 times 1.4628 ms/op 1.4426 ms/op 1.01
byteArrayToHashObject 50023 times 2.8516 ms/op 2.5246 ms/op 1.13
digest64 200092 times 219.37 ms/op 206.17 ms/op 1.06
hash 200092 times using batchHash4UintArray64s 219.55 ms/op 221.05 ms/op 0.99
digest64HashObjects 200092 times 200.69 ms/op
hash 200092 times using batchHash4HashObjectInputs 207.43 ms/op 207.92 ms/op 1.00
getGindicesAtDepth 4.5390 us/op 4.7290 us/op 0.96
iterateAtDepth 8.2660 us/op 7.4460 us/op 1.11
getGindexBits 519.00 ns/op 443.00 ns/op 1.17
gindexIterator 1.1380 us/op 995.00 ns/op 1.14
hash 2 Uint8Array 2250026 times - as-sha256 2.4376 s/op 2.3303 s/op 1.05
hashTwoObjects 2250026 times - as-sha256 2.2595 s/op 2.1571 s/op 1.05
hash 2 Uint8Array 2250026 times - noble 5.1422 s/op 4.9111 s/op 1.05
hashTwoObjects 2250026 times - noble 7.0011 s/op 6.8669 s/op 1.02
getNodeH() x7812.5 avg hindex 12.402 us/op 12.006 us/op 1.03
getNodeH() x7812.5 index 0 6.4780 us/op 6.3840 us/op 1.01
getNodeH() x7812.5 index 7 6.4200 us/op 6.2770 us/op 1.02
getNodeH() x7812.5 index 7 with key array 6.4310 us/op 6.3190 us/op 1.02
new LeafNode() x7812.5 14.882 us/op 14.774 us/op 1.01
multiproof - depth 15, 1 requested leaves 9.0790 us/op 9.0540 us/op 1.00
tree offset multiproof - depth 15, 1 requested leaves 18.640 us/op 18.895 us/op 0.99
compact multiproof - depth 15, 1 requested leaves 3.6660 us/op 3.6910 us/op 0.99
multiproof - depth 15, 2 requested leaves 12.283 us/op 11.834 us/op 1.04
tree offset multiproof - depth 15, 2 requested leaves 22.050 us/op 22.350 us/op 0.99
compact multiproof - depth 15, 2 requested leaves 3.5470 us/op 3.5110 us/op 1.01
multiproof - depth 15, 3 requested leaves 16.950 us/op 16.438 us/op 1.03
tree offset multiproof - depth 15, 3 requested leaves 28.685 us/op 28.375 us/op 1.01
compact multiproof - depth 15, 3 requested leaves 4.3630 us/op 4.3360 us/op 1.01
multiproof - depth 15, 4 requested leaves 22.106 us/op 21.791 us/op 1.01
tree offset multiproof - depth 15, 4 requested leaves 35.883 us/op 34.989 us/op 1.03
compact multiproof - depth 15, 4 requested leaves 5.2170 us/op 5.0690 us/op 1.03
packedRootsBytesToLeafNodes bytes 4000 offset 0 2.0600 us/op 2.0050 us/op 1.03
packedRootsBytesToLeafNodes bytes 4000 offset 1 2.0310 us/op 2.0090 us/op 1.01
packedRootsBytesToLeafNodes bytes 4000 offset 2 1.7900 us/op 2.0030 us/op 0.89
packedRootsBytesToLeafNodes bytes 4000 offset 3 1.7020 us/op 1.7370 us/op 0.98
subtreeFillToContents depth 40 count 250000 45.847 ms/op 46.119 ms/op 0.99
setRoot - gindexBitstring 9.6399 ms/op 8.2033 ms/op 1.18
setRoot - gindex 10.159 ms/op 8.7189 ms/op 1.17
getRoot - gindexBitstring 2.7133 ms/op 2.6208 ms/op 1.04
getRoot - gindex 3.6941 ms/op 3.3839 ms/op 1.09
getHashObject then setHashObject 12.007 ms/op 10.470 ms/op 1.15
setNodeWithFn 9.6170 ms/op 7.7663 ms/op 1.24
getNodeAtDepth depth 0 x100000 1.1130 ms/op 1.1102 ms/op 1.00
setNodeAtDepth depth 0 x100000 2.7647 ms/op 2.3061 ms/op 1.20
getNodesAtDepth depth 0 x100000 1.0527 ms/op 1.0809 ms/op 0.97
setNodesAtDepth depth 0 x100000 1.4850 ms/op 1.4677 ms/op 1.01
getNodeAtDepth depth 1 x100000 1.1771 ms/op 1.1858 ms/op 0.99
setNodeAtDepth depth 1 x100000 6.0504 ms/op 5.1455 ms/op 1.18
getNodesAtDepth depth 1 x100000 1.1772 ms/op 1.2057 ms/op 0.98
setNodesAtDepth depth 1 x100000 4.9883 ms/op 4.3193 ms/op 1.15
getNodeAtDepth depth 2 x100000 1.4875 ms/op 1.4579 ms/op 1.02
setNodeAtDepth depth 2 x100000 11.013 ms/op 8.8385 ms/op 1.25
getNodesAtDepth depth 2 x100000 21.000 ms/op 18.625 ms/op 1.13
setNodesAtDepth depth 2 x100000 14.712 ms/op 12.195 ms/op 1.21
tree.getNodesAtDepth - gindexes 9.7370 ms/op 7.5144 ms/op 1.30
tree.getNodesAtDepth - push all nodes 2.4883 ms/op 1.9786 ms/op 1.26
tree.getNodesAtDepth - navigation 234.72 us/op 236.55 us/op 0.99
tree.setNodesAtDepth - indexes 506.32 us/op 353.74 us/op 1.43
set at depth 8 504.00 ns/op 474.00 ns/op 1.06
set at depth 16 601.00 ns/op 618.00 ns/op 0.97
set at depth 32 955.00 ns/op 966.00 ns/op 0.99
iterateNodesAtDepth 8 256 13.854 us/op 13.575 us/op 1.02
getNodesAtDepth 8 256 3.4800 us/op 3.5080 us/op 0.99
iterateNodesAtDepth 16 65536 4.4760 ms/op 4.3698 ms/op 1.02
getNodesAtDepth 16 65536 1.5942 ms/op 1.7222 ms/op 0.93
iterateNodesAtDepth 32 250000 16.024 ms/op 15.738 ms/op 1.02
getNodesAtDepth 32 250000 4.3867 ms/op 4.4142 ms/op 0.99
iterateNodesAtDepth 40 250000 16.148 ms/op 15.922 ms/op 1.01
getNodesAtDepth 40 250000 4.2787 ms/op 4.3923 ms/op 0.97
250k validators 7.2135 s/op 7.1363 s/op 1.01
bitlist bytes to struct (120,90) 476.00 ns/op 490.00 ns/op 0.97
bitlist bytes to tree (120,90) 2.2000 us/op 2.2200 us/op 0.99
bitlist bytes to struct (2048,2048) 931.00 ns/op 905.00 ns/op 1.03
bitlist bytes to tree (2048,2048) 3.4730 us/op 3.3070 us/op 1.05
ByteListType - deserialize 7.5528 ms/op 7.8274 ms/op 0.96
BasicListType - deserialize 11.805 ms/op 12.344 ms/op 0.96
ByteListType - serialize 7.5334 ms/op 6.3972 ms/op 1.18
BasicListType - serialize 9.7320 ms/op 9.7025 ms/op 1.00
BasicListType - tree_convertToStruct 19.568 ms/op 22.973 ms/op 0.85
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.2694 ms/op 4.3801 ms/op 0.97
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.0067 ms/op 2.9349 ms/op 1.37
Array.push len 300000 empty Array - number 6.5062 ms/op 6.3491 ms/op 1.02
Array.set len 300000 from new Array - number 1.7857 ms/op 1.7588 ms/op 1.02
Array.set len 300000 - number 5.3297 ms/op 5.4034 ms/op 0.99
Uint8Array.set len 300000 382.01 us/op 371.95 us/op 1.03
Uint32Array.set len 300000 454.52 us/op 449.14 us/op 1.01
Container({a: uint8, b: uint8}) getViewDU x300000 54.861 ms/op 50.922 ms/op 1.08
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 10.862 ms/op 10.727 ms/op 1.01
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 202.02 ms/op 208.93 ms/op 0.97
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 269.89 ms/op 249.80 ms/op 1.08
List(Container) len 300000 ViewDU.get(i) 6.5362 ms/op 6.9110 ms/op 0.95
List(Container) len 300000 ViewDU.getReadonly(i) 6.6868 ms/op 6.3930 ms/op 1.05
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 38.596 ms/op 38.916 ms/op 0.99
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 4.5680 ms/op 5.3279 ms/op 0.86
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.3153 ms/op 5.9629 ms/op 1.06
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.1176 ms/op 5.9201 ms/op 1.03
Array.push len 300000 empty Array - object 6.2933 ms/op 5.9600 ms/op 1.06
Array.set len 300000 from new Array - object 2.0532 ms/op 2.0556 ms/op 1.00
Array.set len 300000 - object 6.5514 ms/op 5.8189 ms/op 1.13
cachePermanentRootStruct no cache 8.7610 us/op 8.6950 us/op 1.01
cachePermanentRootStruct with cache 218.00 ns/op 192.00 ns/op 1.14
epochParticipation len 250000 rws 7813 2.2103 ms/op 2.2112 ms/op 1.00
deserialize Attestation - tree 4.0390 us/op 4.0850 us/op 0.99
deserialize Attestation - struct 1.8450 us/op 1.7520 us/op 1.05
deserialize SignedAggregateAndProof - tree 3.6240 us/op 3.5770 us/op 1.01
deserialize SignedAggregateAndProof - struct 3.0280 us/op 2.9340 us/op 1.03
deserialize SyncCommitteeMessage - tree 1.0820 us/op 1.0450 us/op 1.04
deserialize SyncCommitteeMessage - struct 1.0870 us/op 1.0620 us/op 1.02
deserialize SignedContributionAndProof - tree 1.9900 us/op 1.9690 us/op 1.01
deserialize SignedContributionAndProof - struct 2.2530 us/op 2.2270 us/op 1.01
deserialize SignedBeaconBlock - tree 209.43 us/op 205.57 us/op 1.02
deserialize SignedBeaconBlock - struct 115.06 us/op 114.17 us/op 1.01
BeaconState vc 300000 - deserialize tree 580.64 ms/op 556.43 ms/op 1.04
BeaconState vc 300000 - serialize tree 151.52 ms/op 124.39 ms/op 1.22
BeaconState.historicalRoots vc 300000 - deserialize tree 745.00 ns/op 708.00 ns/op 1.05
BeaconState.historicalRoots vc 300000 - serialize tree 679.00 ns/op 622.00 ns/op 1.09
BeaconState.validators vc 300000 - deserialize tree 514.18 ms/op 504.37 ms/op 1.02
BeaconState.validators vc 300000 - serialize tree 97.830 ms/op 96.312 ms/op 1.02
BeaconState.balances vc 300000 - deserialize tree 20.508 ms/op 21.089 ms/op 0.97
BeaconState.balances vc 300000 - serialize tree 4.0502 ms/op 3.6069 ms/op 1.12
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 517.46 us/op 439.15 us/op 1.18
BeaconState.previousEpochParticipation vc 300000 - serialize tree 286.89 us/op 290.83 us/op 0.99
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 528.94 us/op 420.11 us/op 1.26
BeaconState.currentEpochParticipation vc 300000 - serialize tree 286.18 us/op 285.56 us/op 1.00
BeaconState.inactivityScores vc 300000 - deserialize tree 20.723 ms/op 21.403 ms/op 0.97
BeaconState.inactivityScores vc 300000 - serialize tree 3.2710 ms/op 3.5989 ms/op 0.91
hashTreeRoot Attestation - struct 28.076 us/op 32.782 us/op 0.86
hashTreeRoot Attestation - tree 19.672 us/op 18.693 us/op 1.05
hashTreeRoot SignedAggregateAndProof - struct 38.253 us/op 42.011 us/op 0.91
hashTreeRoot SignedAggregateAndProof - tree 27.997 us/op 29.218 us/op 0.96
hashTreeRoot SyncCommitteeMessage - struct 9.1100 us/op 9.8200 us/op 0.93
hashTreeRoot SyncCommitteeMessage - tree 6.2460 us/op 6.7850 us/op 0.92
hashTreeRoot SignedContributionAndProof - struct 26.066 us/op 26.280 us/op 0.99
hashTreeRoot SignedContributionAndProof - tree 19.111 us/op 20.019 us/op 0.95
hashTreeRoot SignedBeaconBlock - struct 2.2769 ms/op 2.3074 ms/op 0.99
hashTreeRoot SignedBeaconBlock - tree 1.6702 ms/op 1.7467 ms/op 0.96
hashTreeRoot Validator - struct 12.516 us/op 11.697 us/op 1.07
hashTreeRoot Validator - tree 10.655 us/op 10.477 us/op 1.02
BeaconState vc 300000 - hashTreeRoot tree 3.5898 s/op 3.5544 s/op 1.01
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.3150 us/op 1.3280 us/op 0.99
BeaconState.validators vc 300000 - hashTreeRoot tree 3.4493 s/op 3.3667 s/op 1.02
BeaconState.balances vc 300000 - hashTreeRoot tree 83.772 ms/op 83.677 ms/op 1.00
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 9.1643 ms/op 9.0275 ms/op 1.02
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 8.9522 ms/op 9.0168 ms/op 0.99
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 82.430 ms/op 81.442 ms/op 1.01
hash64 x18 19.294 us/op 18.987 us/op 1.02
hashTwoObjects x18 18.213 us/op 18.050 us/op 1.01
hash64 x1740 1.8217 ms/op 1.7863 ms/op 1.02
hashTwoObjects x1740 1.6918 ms/op 1.7116 ms/op 0.99
hash64 x2700000 2.8275 s/op 2.7833 s/op 1.02
hashTwoObjects x2700000 2.6335 s/op 2.6339 s/op 1.00
get_exitEpoch - ContainerType 188.00 ns/op 200.00 ns/op 0.94
get_exitEpoch - ContainerNodeStructType 173.00 ns/op 191.00 ns/op 0.91
set_exitEpoch - ContainerType 216.00 ns/op 213.00 ns/op 1.01
set_exitEpoch - ContainerNodeStructType 200.00 ns/op 239.00 ns/op 0.84
get_pubkey - ContainerType 851.00 ns/op 866.00 ns/op 0.98
get_pubkey - ContainerNodeStructType 191.00 ns/op 219.00 ns/op 0.87
hashTreeRoot - ContainerType 321.00 ns/op 331.00 ns/op 0.97
hashTreeRoot - ContainerNodeStructType 383.00 ns/op 376.00 ns/op 1.02
createProof - ContainerType 3.7370 us/op 3.7060 us/op 1.01
createProof - ContainerNodeStructType 19.490 us/op 19.631 us/op 0.99
serialize - ContainerType 1.5970 us/op 1.6640 us/op 0.96
serialize - ContainerNodeStructType 1.3140 us/op 1.3400 us/op 0.98
set_exitEpoch_and_hashTreeRoot - ContainerType 4.1400 us/op 4.0500 us/op 1.02
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 11.060 us/op 10.836 us/op 1.02
Array - for of 5.7370 us/op 6.6800 us/op 0.86
Array - for(;;) 5.6500 us/op 6.4110 us/op 0.88
basicListValue.readonlyValuesArray() 3.8843 ms/op 3.8392 ms/op 1.01
basicListValue.readonlyValuesArray() + loop all 4.0766 ms/op 4.0383 ms/op 1.01
compositeListValue.readonlyValuesArray() 27.889 ms/op 29.054 ms/op 0.96
compositeListValue.readonlyValuesArray() + loop all 28.943 ms/op 26.495 ms/op 1.09
Number64UintType - get balances list 4.3375 ms/op 4.2007 ms/op 1.03
Number64UintType - set balances list 10.631 ms/op 10.595 ms/op 1.00
Number64UintType - get and increase 10 then set 39.207 ms/op 40.170 ms/op 0.98
Number64UintType - increase 10 using applyDelta 16.760 ms/op 16.103 ms/op 1.04
Number64UintType - increase 10 using applyDeltaInBatch 16.817 ms/op 16.138 ms/op 1.04
tree_newTreeFromUint64Deltas 16.419 ms/op 16.661 ms/op 0.99
unsafeUint8ArrayToTree 27.668 ms/op 27.704 ms/op 1.00
bitLength(50) 224.00 ns/op 213.00 ns/op 1.05
bitLengthStr(50) 204.00 ns/op 204.00 ns/op 1.00
bitLength(8000) 213.00 ns/op 205.00 ns/op 1.04
bitLengthStr(8000) 247.00 ns/op 247.00 ns/op 1.00
bitLength(250000) 207.00 ns/op 208.00 ns/op 1.00
bitLengthStr(250000) 283.00 ns/op 278.00 ns/op 1.02
floor - Math.floor (53) 1.2365 ns/op 1.2369 ns/op 1.00
floor - << 0 (53) 1.2385 ns/op 1.2425 ns/op 1.00
floor - Math.floor (512) 1.2549 ns/op 1.2375 ns/op 1.01
floor - << 0 (512) 1.2370 ns/op 1.2366 ns/op 1.00
fnIf(0) 1.5688 ns/op 1.5477 ns/op 1.01
fnSwitch(0) 2.1638 ns/op 2.1641 ns/op 1.00
fnObj(0) 1.5710 ns/op 1.5460 ns/op 1.02
fnArr(0) 1.5463 ns/op 1.5466 ns/op 1.00
fnIf(4) 2.1721 ns/op 2.1644 ns/op 1.00
fnSwitch(4) 2.1791 ns/op 2.1656 ns/op 1.01
fnObj(4) 1.5499 ns/op 1.5556 ns/op 1.00
fnArr(4) 1.5474 ns/op 1.5505 ns/op 1.00
fnIf(9) 3.0948 ns/op 3.0924 ns/op 1.00
fnSwitch(9) 2.1665 ns/op 2.1640 ns/op 1.00
fnObj(9) 1.5494 ns/op 1.5468 ns/op 1.00
fnArr(9) 1.5562 ns/op 1.5467 ns/op 1.01
Container {a,b,vec} - as struct x100000 123.82 us/op 123.78 us/op 1.00
Container {a,b,vec} - as tree x100000 340.44 us/op 340.37 us/op 1.00
Container {a,vec,b} - as struct x100000 154.78 us/op 157.03 us/op 0.99
Container {a,vec,b} - as tree x100000 371.21 us/op 371.24 us/op 1.00
get 2 props x1000000 - rawObject 313.02 us/op 309.56 us/op 1.01
get 2 props x1000000 - proxy 73.887 ms/op 72.698 ms/op 1.02
get 2 props x1000000 - customObj 310.76 us/op 309.34 us/op 1.00
Simple object binary -> struct 576.00 ns/op 555.00 ns/op 1.04
Simple object binary -> tree_backed 1.0370 us/op 978.00 ns/op 1.06
Simple object struct -> tree_backed 1.5040 us/op 1.4670 us/op 1.03
Simple object tree_backed -> struct 1.5270 us/op 1.5230 us/op 1.00
Simple object struct -> binary 784.00 ns/op 829.00 ns/op 0.95
Simple object tree_backed -> binary 1.3610 us/op 1.2470 us/op 1.09
aggregationBits binary -> struct 460.00 ns/op 445.00 ns/op 1.03
aggregationBits binary -> tree_backed 1.9730 us/op 1.8330 us/op 1.08
aggregationBits struct -> tree_backed 2.3380 us/op 2.2310 us/op 1.05
aggregationBits tree_backed -> struct 1.0550 us/op 928.00 ns/op 1.14
aggregationBits struct -> binary 769.00 ns/op 683.00 ns/op 1.13
aggregationBits tree_backed -> binary 880.00 ns/op 822.00 ns/op 1.07
List(uint8) 100000 binary -> struct 1.5240 ms/op 1.4181 ms/op 1.07
List(uint8) 100000 binary -> tree_backed 93.110 us/op 87.831 us/op 1.06
List(uint8) 100000 struct -> tree_backed 1.1342 ms/op 1.1019 ms/op 1.03
List(uint8) 100000 tree_backed -> struct 1.0699 ms/op 990.82 us/op 1.08
List(uint8) 100000 struct -> binary 988.32 us/op 987.19 us/op 1.00
List(uint8) 100000 tree_backed -> binary 87.071 us/op 87.105 us/op 1.00
List(uint64Number) 100000 binary -> struct 1.2320 ms/op 1.1287 ms/op 1.09
List(uint64Number) 100000 binary -> tree_backed 2.7846 ms/op 2.4237 ms/op 1.15
List(uint64Number) 100000 struct -> tree_backed 3.8787 ms/op 4.0909 ms/op 0.95
List(uint64Number) 100000 tree_backed -> struct 2.0539 ms/op 2.0891 ms/op 0.98
List(uint64Number) 100000 struct -> binary 1.3910 ms/op 1.3732 ms/op 1.01
List(uint64Number) 100000 tree_backed -> binary 815.70 us/op 857.72 us/op 0.95
List(Uint64Bigint) 100000 binary -> struct 3.4721 ms/op 3.5005 ms/op 0.99
List(Uint64Bigint) 100000 binary -> tree_backed 3.1762 ms/op 2.9895 ms/op 1.06
List(Uint64Bigint) 100000 struct -> tree_backed 5.1128 ms/op 5.0203 ms/op 1.02
List(Uint64Bigint) 100000 tree_backed -> struct 4.5127 ms/op 4.2791 ms/op 1.05
List(Uint64Bigint) 100000 struct -> binary 2.0327 ms/op 2.0684 ms/op 0.98
List(Uint64Bigint) 100000 tree_backed -> binary 909.48 us/op 861.92 us/op 1.06
Vector(Root) 100000 binary -> struct 28.990 ms/op 29.441 ms/op 0.98
Vector(Root) 100000 binary -> tree_backed 28.697 ms/op 24.521 ms/op 1.17
Vector(Root) 100000 struct -> tree_backed 36.511 ms/op 36.168 ms/op 1.01
Vector(Root) 100000 tree_backed -> struct 43.750 ms/op 43.454 ms/op 1.01
Vector(Root) 100000 struct -> binary 2.5432 ms/op 2.5042 ms/op 1.02
Vector(Root) 100000 tree_backed -> binary 9.5746 ms/op 8.4305 ms/op 1.14
List(Validator) 100000 binary -> struct 105.19 ms/op 97.389 ms/op 1.08
List(Validator) 100000 binary -> tree_backed 282.22 ms/op 256.99 ms/op 1.10
List(Validator) 100000 struct -> tree_backed 286.95 ms/op 283.39 ms/op 1.01
List(Validator) 100000 tree_backed -> struct 186.97 ms/op 189.31 ms/op 0.99
List(Validator) 100000 struct -> binary 26.752 ms/op 26.811 ms/op 1.00
List(Validator) 100000 tree_backed -> binary 97.325 ms/op 101.42 ms/op 0.96
List(Validator-NS) 100000 binary -> struct 95.486 ms/op 95.106 ms/op 1.00
List(Validator-NS) 100000 binary -> tree_backed 138.61 ms/op 132.13 ms/op 1.05
List(Validator-NS) 100000 struct -> tree_backed 165.13 ms/op 159.48 ms/op 1.04
List(Validator-NS) 100000 tree_backed -> struct 146.27 ms/op 141.56 ms/op 1.03
List(Validator-NS) 100000 struct -> binary 26.982 ms/op 26.835 ms/op 1.01
List(Validator-NS) 100000 tree_backed -> binary 33.540 ms/op 30.979 ms/op 1.08
get epochStatuses - MutableVector 98.418 us/op 89.507 us/op 1.10
get epochStatuses - ViewDU 215.08 us/op 202.50 us/op 1.06
set epochStatuses - ListTreeView 1.6441 ms/op 1.4412 ms/op 1.14
set epochStatuses - ListTreeView - set() 436.43 us/op 434.78 us/op 1.00
set epochStatuses - ListTreeView - commit() 525.56 us/op 433.71 us/op 1.21
bitstring 643.02 ns/op 638.89 ns/op 1.01
bit mask 14.036 ns/op 13.479 ns/op 1.04
struct - increase slot to 1000000 928.28 us/op 927.62 us/op 1.00
UintNumberType - increase slot to 1000000 21.784 ms/op 21.670 ms/op 1.01
UintBigintType - increase slot to 1000000 164.81 ms/op 166.68 ms/op 0.99
UintBigint8 x 100000 tree_deserialize 4.7764 ms/op 4.4755 ms/op 1.07
UintBigint8 x 100000 tree_serialize 1.1180 ms/op 1.0908 ms/op 1.02
UintBigint16 x 100000 tree_deserialize 4.7622 ms/op 4.5566 ms/op 1.05
UintBigint16 x 100000 tree_serialize 1.2024 ms/op 1.1682 ms/op 1.03
UintBigint32 x 100000 tree_deserialize 4.7884 ms/op 4.6238 ms/op 1.04
UintBigint32 x 100000 tree_serialize 1.2128 ms/op 1.1813 ms/op 1.03
UintBigint64 x 100000 tree_deserialize 5.5615 ms/op 5.3241 ms/op 1.04
UintBigint64 x 100000 tree_serialize 1.5751 ms/op 1.5455 ms/op 1.02
UintBigint8 x 100000 value_deserialize 438.78 us/op 433.09 us/op 1.01
UintBigint8 x 100000 value_serialize 646.65 us/op 613.98 us/op 1.05
UintBigint16 x 100000 value_deserialize 464.12 us/op 465.11 us/op 1.00
UintBigint16 x 100000 value_serialize 711.59 us/op 673.76 us/op 1.06
UintBigint32 x 100000 value_deserialize 434.02 us/op 433.45 us/op 1.00
UintBigint32 x 100000 value_serialize 679.61 us/op 642.85 us/op 1.06
UintBigint64 x 100000 value_deserialize 496.46 us/op 536.29 us/op 0.93
UintBigint64 x 100000 value_serialize 858.72 us/op 820.04 us/op 1.05
UintBigint8 x 100000 deserialize 3.0271 ms/op 2.9207 ms/op 1.04
UintBigint8 x 100000 serialize 1.5590 ms/op 1.5275 ms/op 1.02
UintBigint16 x 100000 deserialize 2.8865 ms/op 2.9470 ms/op 0.98
UintBigint16 x 100000 serialize 1.5257 ms/op 1.5021 ms/op 1.02
UintBigint32 x 100000 deserialize 2.8339 ms/op 2.9789 ms/op 0.95
UintBigint32 x 100000 serialize 2.6859 ms/op 2.8512 ms/op 0.94
UintBigint64 x 100000 deserialize 3.8661 ms/op 3.5924 ms/op 1.08
UintBigint64 x 100000 serialize 1.4993 ms/op 1.5112 ms/op 0.99
UintBigint128 x 100000 deserialize 4.8732 ms/op 4.8819 ms/op 1.00
UintBigint128 x 100000 serialize 15.418 ms/op 13.846 ms/op 1.11
UintBigint256 x 100000 deserialize 7.9104 ms/op 7.6482 ms/op 1.03
UintBigint256 x 100000 serialize 46.626 ms/op 41.190 ms/op 1.13
Slice from Uint8Array x25000 1.2524 ms/op 1.1141 ms/op 1.12
Slice from ArrayBuffer x25000 16.207 ms/op 15.704 ms/op 1.03
Slice from ArrayBuffer x25000 + new Uint8Array 17.720 ms/op 15.334 ms/op 1.16
Copy Uint8Array 100000 iterate 1.6751 ms/op 1.6662 ms/op 1.01
Copy Uint8Array 100000 slice 108.24 us/op 113.73 us/op 0.95
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 107.78 us/op 113.42 us/op 0.95
Copy Buffer 100000 Uint8Array.prototype.slice.call 108.21 us/op 117.75 us/op 0.92
Copy Uint8Array 100000 slice + set 176.11 us/op 185.16 us/op 0.95
Copy Uint8Array 100000 subarray + set 108.39 us/op 118.83 us/op 0.91
Copy Uint8Array 100000 slice arrayBuffer 108.83 us/op 121.31 us/op 0.90
Uint64 deserialize 100000 - iterate Uint8Array 1.7292 ms/op 1.7122 ms/op 1.01
Uint64 deserialize 100000 - by Uint32A 1.8211 ms/op 1.7533 ms/op 1.04
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.8491 ms/op 1.7972 ms/op 1.03
Uint64 deserialize 100000 - by DataView.getBigUint64 5.0087 ms/op 4.8335 ms/op 1.04
Uint64 deserialize 100000 - by byte 40.518 ms/op 39.830 ms/op 1.02

by benchmarkbot/action

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

Can you add a section to the PR description labeled BREAKING CHANGE that describes what has broken?

@twoeths
Copy link
Contributor Author

twoeths commented Jul 16, 2024

Can you add a section to the PR description labeled BREAKING CHANGE that describes what has broken?

I just added it 👍

@twoeths twoeths merged commit ccadf43 into master Jul 16, 2024
9 checks passed
@twoeths twoeths deleted the te/as_sha256_hash_into branch July 16, 2024 01:53
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm post merge review

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.

3 participants