ssz icon indicating copy to clipboard operation
ssz copied to clipboard

fix: findDiffDepthi to support more than 31 bytes

Open twoeths opened this issue 1 year ago • 1 comments

Motivation

The current findDiffDepthi only support up to 31 bits due to bit xor ^ limitation

Description

Support > 32 bits numbers:

  • Return early of number of bits between index0 and index1 are different
  • If it's > 32 bits, separate to higher bits part and lower bits part by masking operation

Fix the 32 bits number:

  • Fix findDiffDepthi() itself by handling non-positive xor result

Closes #370

Steps to test or reproduce

Run all unit tests

twoeths avatar Apr 26 '24 08:04 twoeths

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 46ebaf5a4da9cc95c3c886e6aeb6bc6dca930cc6 Previous: cf8f04905e8d93fd44e59a319e1431f5b932d0e3 Ratio
digestTwoHashObjects 50023 times 47.735 ms/op 47.926 ms/op 1.00
digest64 50023 times 50.522 ms/op 50.930 ms/op 0.99
digest 50023 times 56.414 ms/op 52.992 ms/op 1.06
input length 32 1.2530 us/op 1.1920 us/op 1.05
input length 64 1.4200 us/op 1.3970 us/op 1.02
input length 128 2.5890 us/op 2.3880 us/op 1.08
input length 256 3.7340 us/op 3.4430 us/op 1.08
input length 512 6.1350 us/op 5.6190 us/op 1.09
input length 1024 11.437 us/op 10.763 us/op 1.06
digest 1000000 times 882.65 ms/op 837.14 ms/op 1.05
hashObjectToByteArray 50023 times 1.4311 ms/op 1.4692 ms/op 0.97
byteArrayToHashObject 50023 times 2.4457 ms/op 2.4603 ms/op 0.99
getGindicesAtDepth 4.7260 us/op 4.6690 us/op 1.01
iterateAtDepth 8.4410 us/op 7.4530 us/op 1.13
getGindexBits 440.00 ns/op 430.00 ns/op 1.02
gindexIterator 1.0180 us/op 972.00 ns/op 1.05
hash 2 Uint8Array 2250026 times - as-sha256 2.4970 s/op 2.3533 s/op 1.06
hashTwoObjects 2250026 times - as-sha256 2.4424 s/op 2.2222 s/op 1.10
hash 2 Uint8Array 2250026 times - noble 5.6254 s/op 5.2452 s/op 1.07
hashTwoObjects 2250026 times - noble 7.6145 s/op 6.8410 s/op 1.11
getNodeH() x7812.5 avg hindex 13.090 us/op 12.969 us/op 1.01
getNodeH() x7812.5 index 0 6.7210 us/op 6.6040 us/op 1.02
getNodeH() x7812.5 index 7 6.7100 us/op 6.5780 us/op 1.02
getNodeH() x7812.5 index 7 with key array 6.7350 us/op 6.4950 us/op 1.04
new LeafNode() x7812.5 15.116 us/op 15.032 us/op 1.01
multiproof - depth 15, 1 requested leaves 9.5320 us/op 9.6410 us/op 0.99
tree offset multiproof - depth 15, 1 requested leaves 20.489 us/op 20.563 us/op 1.00
compact multiproof - depth 15, 1 requested leaves 5.4940 us/op 5.4290 us/op 1.01
multiproof - depth 15, 2 requested leaves 13.497 us/op 12.903 us/op 1.05
tree offset multiproof - depth 15, 2 requested leaves 24.132 us/op 23.655 us/op 1.02
compact multiproof - depth 15, 2 requested leaves 4.6620 us/op 4.4640 us/op 1.04
multiproof - depth 15, 3 requested leaves 18.282 us/op 18.176 us/op 1.01
tree offset multiproof - depth 15, 3 requested leaves 31.470 us/op 29.919 us/op 1.05
compact multiproof - depth 15, 3 requested leaves 5.1650 us/op 6.4790 us/op 0.80
multiproof - depth 15, 4 requested leaves 23.349 us/op 23.370 us/op 1.00
tree offset multiproof - depth 15, 4 requested leaves 37.933 us/op 36.995 us/op 1.03
compact multiproof - depth 15, 4 requested leaves 6.2200 us/op 5.3080 us/op 1.17
packedRootsBytesToLeafNodes bytes 4000 offset 0 2.0950 us/op 1.9930 us/op 1.05
packedRootsBytesToLeafNodes bytes 4000 offset 1 2.0930 us/op 2.0020 us/op 1.05
packedRootsBytesToLeafNodes bytes 4000 offset 2 2.0670 us/op 2.0000 us/op 1.03
packedRootsBytesToLeafNodes bytes 4000 offset 3 2.0790 us/op 1.9940 us/op 1.04
subtreeFillToContents depth 40 count 250000 48.374 ms/op 45.958 ms/op 1.05
setRoot - gindexBitstring 8.3245 ms/op 8.4206 ms/op 0.99
setRoot - gindex 8.6746 ms/op 8.7619 ms/op 0.99
getRoot - gindexBitstring 2.7833 ms/op 2.4504 ms/op 1.14
getRoot - gindex 3.4527 ms/op 3.3620 ms/op 1.03
getHashObject then setHashObject 10.538 ms/op 10.481 ms/op 1.01
setNodeWithFn 8.1019 ms/op 8.0530 ms/op 1.01
getNodeAtDepth depth 0 x100000 1.1318 ms/op 1.0852 ms/op 1.04
setNodeAtDepth depth 0 x100000 2.3839 ms/op 2.4234 ms/op 0.98
getNodesAtDepth depth 0 x100000 1.0526 ms/op 1.0538 ms/op 1.00
setNodesAtDepth depth 0 x100000 1.4585 ms/op 1.4528 ms/op 1.00
getNodeAtDepth depth 1 x100000 1.1820 ms/op 1.1686 ms/op 1.01
setNodeAtDepth depth 1 x100000 5.2225 ms/op 5.1398 ms/op 1.02
getNodesAtDepth depth 1 x100000 1.2086 ms/op 1.1909 ms/op 1.01
setNodesAtDepth depth 1 x100000 4.5265 ms/op 4.3132 ms/op 1.05
getNodeAtDepth depth 2 x100000 1.4544 ms/op 1.4221 ms/op 1.02
setNodeAtDepth depth 2 x100000 9.3030 ms/op 10.417 ms/op 0.89
getNodesAtDepth depth 2 x100000 19.088 ms/op 18.389 ms/op 1.04
setNodesAtDepth depth 2 x100000 13.660 ms/op 12.926 ms/op 1.06
tree.getNodesAtDepth - gindexes 9.5714 ms/op 8.0320 ms/op 1.19
tree.getNodesAtDepth - push all nodes 1.9566 ms/op 1.9345 ms/op 1.01
tree.getNodesAtDepth - navigation 232.46 us/op 235.57 us/op 0.99
tree.setNodesAtDepth - indexes 432.83 us/op 308.89 us/op 1.40
set at depth 8 489.00 ns/op 450.00 ns/op 1.09
set at depth 16 635.00 ns/op 596.00 ns/op 1.07
set at depth 32 978.00 ns/op 958.00 ns/op 1.02
iterateNodesAtDepth 8 256 14.882 us/op 13.212 us/op 1.13
getNodesAtDepth 8 256 3.6670 us/op 3.3790 us/op 1.09
iterateNodesAtDepth 16 65536 4.4991 ms/op 4.3308 ms/op 1.04
getNodesAtDepth 16 65536 1.6181 ms/op 1.6273 ms/op 0.99
iterateNodesAtDepth 32 250000 16.365 ms/op 15.634 ms/op 1.05
getNodesAtDepth 32 250000 4.5989 ms/op 4.3522 ms/op 1.06
iterateNodesAtDepth 40 250000 16.537 ms/op 15.708 ms/op 1.05
getNodesAtDepth 40 250000 4.9333 ms/op 4.4330 ms/op 1.11
250k validators 7.8759 s/op 7.1114 s/op 1.11
bitlist bytes to struct (120,90) 510.00 ns/op 484.00 ns/op 1.05
bitlist bytes to tree (120,90) 2.2830 us/op 2.1460 us/op 1.06
bitlist bytes to struct (2048,2048) 1.0460 us/op 922.00 ns/op 1.13
bitlist bytes to tree (2048,2048) 3.3930 us/op 3.3630 us/op 1.01
ByteListType - deserialize 9.4779 ms/op 7.3046 ms/op 1.30
BasicListType - deserialize 12.100 ms/op 11.915 ms/op 1.02
ByteListType - serialize 10.503 ms/op 7.9004 ms/op 1.33
BasicListType - serialize 11.318 ms/op 10.023 ms/op 1.13
BasicListType - tree_convertToStruct 25.606 ms/op 22.655 ms/op 1.13
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.6882 ms/op 4.4147 ms/op 1.06
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.3248 ms/op 2.9512 ms/op 1.47
Array.push len 300000 empty Array - number 7.4008 ms/op 6.2896 ms/op 1.18
Array.set len 300000 from new Array - number 1.7558 ms/op 1.7071 ms/op 1.03
Array.set len 300000 - number 6.1978 ms/op 5.2257 ms/op 1.19
Uint8Array.set len 300000 385.24 us/op 372.38 us/op 1.03
Uint32Array.set len 300000 467.84 us/op 445.15 us/op 1.05
Container({a: uint8, b: uint8}) getViewDU x300000 52.449 ms/op 49.804 ms/op 1.05
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 11.701 ms/op 10.834 ms/op 1.08
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 223.38 ms/op 209.73 ms/op 1.07
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 281.78 ms/op 273.31 ms/op 1.03
List(Container) len 300000 ViewDU.get(i) 7.2651 ms/op 6.3717 ms/op 1.14
List(Container) len 300000 ViewDU.getReadonly(i) 7.3809 ms/op 6.3376 ms/op 1.16
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 36.257 ms/op 41.496 ms/op 0.87
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 8.4957 ms/op 5.1590 ms/op 1.65
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 7.7018 ms/op 5.9948 ms/op 1.28
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 7.4532 ms/op 5.9572 ms/op 1.25
Array.push len 300000 empty Array - object 6.8254 ms/op 5.9218 ms/op 1.15
Array.set len 300000 from new Array - object 1.9532 ms/op 1.9831 ms/op 0.98
Array.set len 300000 - object 6.5461 ms/op 5.7016 ms/op 1.15
cachePermanentRootStruct no cache 9.1430 us/op 8.5850 us/op 1.06
cachePermanentRootStruct with cache 221.00 ns/op 188.00 ns/op 1.18
epochParticipation len 250000 rws 7813 2.2573 ms/op 1.8994 ms/op 1.19
deserialize Attestation - tree 4.1790 us/op 4.0490 us/op 1.03
deserialize Attestation - struct 2.0870 us/op 1.7750 us/op 1.18
deserialize SignedAggregateAndProof - tree 4.0470 us/op 3.6180 us/op 1.12
deserialize SignedAggregateAndProof - struct 3.3490 us/op 2.9150 us/op 1.15
deserialize SyncCommitteeMessage - tree 1.1120 us/op 1.0360 us/op 1.07
deserialize SyncCommitteeMessage - struct 1.2400 us/op 980.00 ns/op 1.27
deserialize SignedContributionAndProof - tree 2.1940 us/op 1.9690 us/op 1.11
deserialize SignedContributionAndProof - struct 2.5930 us/op 2.3590 us/op 1.10
deserialize SignedBeaconBlock - tree 228.40 us/op 208.32 us/op 1.10
deserialize SignedBeaconBlock - struct 133.69 us/op 120.84 us/op 1.11
BeaconState vc 300000 - deserialize tree 609.22 ms/op 593.02 ms/op 1.03
BeaconState vc 300000 - serialize tree 133.71 ms/op 148.19 ms/op 0.90
BeaconState.historicalRoots vc 300000 - deserialize tree 794.00 ns/op 821.00 ns/op 0.97
BeaconState.historicalRoots vc 300000 - serialize tree 687.00 ns/op 765.00 ns/op 0.90
BeaconState.validators vc 300000 - deserialize tree 549.23 ms/op 521.80 ms/op 1.05
BeaconState.validators vc 300000 - serialize tree 98.567 ms/op 102.19 ms/op 0.96
BeaconState.balances vc 300000 - deserialize tree 19.488 ms/op 20.686 ms/op 0.94
BeaconState.balances vc 300000 - serialize tree 5.2800 ms/op 3.9926 ms/op 1.32
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 765.95 us/op 684.49 us/op 1.12
BeaconState.previousEpochParticipation vc 300000 - serialize tree 297.96 us/op 288.96 us/op 1.03
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 683.76 us/op 450.13 us/op 1.52
BeaconState.currentEpochParticipation vc 300000 - serialize tree 300.63 us/op 287.17 us/op 1.05
BeaconState.inactivityScores vc 300000 - deserialize tree 23.053 ms/op 20.081 ms/op 1.15
BeaconState.inactivityScores vc 300000 - serialize tree 5.3954 ms/op 3.6692 ms/op 1.47
hashTreeRoot Attestation - struct 34.071 us/op 27.463 us/op 1.24
hashTreeRoot Attestation - tree 23.442 us/op 18.111 us/op 1.29
hashTreeRoot SignedAggregateAndProof - struct 43.664 us/op 37.426 us/op 1.17
hashTreeRoot SignedAggregateAndProof - tree 27.140 us/op 27.126 us/op 1.00
hashTreeRoot SyncCommitteeMessage - struct 10.199 us/op 8.9650 us/op 1.14
hashTreeRoot SyncCommitteeMessage - tree 6.1680 us/op 6.3710 us/op 0.97
hashTreeRoot SignedContributionAndProof - struct 29.921 us/op 24.215 us/op 1.24
hashTreeRoot SignedContributionAndProof - tree 18.425 us/op 19.253 us/op 0.96
hashTreeRoot SignedBeaconBlock - struct 2.5437 ms/op 2.1739 ms/op 1.17
hashTreeRoot SignedBeaconBlock - tree 1.6686 ms/op 1.6946 ms/op 0.98
hashTreeRoot Validator - struct 12.670 us/op 12.096 us/op 1.05
hashTreeRoot Validator - tree 11.033 us/op 10.355 us/op 1.07
BeaconState vc 300000 - hashTreeRoot tree 3.7277 s/op 3.6525 s/op 1.02
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.3030 us/op 1.3400 us/op 0.97
BeaconState.validators vc 300000 - hashTreeRoot tree 3.4848 s/op 3.4974 s/op 1.00
BeaconState.balances vc 300000 - hashTreeRoot tree 85.351 ms/op 86.452 ms/op 0.99
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 9.0117 ms/op 9.0131 ms/op 1.00
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 9.0031 ms/op 9.0085 ms/op 1.00
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 83.678 ms/op 86.569 ms/op 0.97
hash64 x18 19.457 us/op 19.358 us/op 1.01
hashTwoObjects x18 17.960 us/op 17.861 us/op 1.01
hash64 x1740 1.8271 ms/op 1.8124 ms/op 1.01
hashTwoObjects x1740 1.7284 ms/op 1.7224 ms/op 1.00
hash64 x2700000 2.8330 s/op 2.8213 s/op 1.00
hashTwoObjects x2700000 2.6575 s/op 2.6376 s/op 1.01
get_exitEpoch - ContainerType 199.00 ns/op 190.00 ns/op 1.05
get_exitEpoch - ContainerNodeStructType 200.00 ns/op 190.00 ns/op 1.05
set_exitEpoch - ContainerType 233.00 ns/op 254.00 ns/op 0.92
set_exitEpoch - ContainerNodeStructType 207.00 ns/op 204.00 ns/op 1.01
get_pubkey - ContainerType 948.00 ns/op 854.00 ns/op 1.11
get_pubkey - ContainerNodeStructType 204.00 ns/op 201.00 ns/op 1.01
hashTreeRoot - ContainerType 342.00 ns/op 337.00 ns/op 1.01
hashTreeRoot - ContainerNodeStructType 393.00 ns/op 378.00 ns/op 1.04
createProof - ContainerType 3.8260 us/op 3.7110 us/op 1.03
createProof - ContainerNodeStructType 20.041 us/op 19.853 us/op 1.01
serialize - ContainerType 1.7080 us/op 1.7860 us/op 0.96
serialize - ContainerNodeStructType 1.3170 us/op 1.5830 us/op 0.83
set_exitEpoch_and_hashTreeRoot - ContainerType 4.1170 us/op 4.1860 us/op 0.98
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 10.855 us/op 11.102 us/op 0.98
Array - for of 16.459 us/op 5.6380 us/op 2.92
Array - for(;;) 16.947 us/op 5.4620 us/op 3.10
basicListValue.readonlyValuesArray() 4.0695 ms/op 4.2076 ms/op 0.97
basicListValue.readonlyValuesArray() + loop all 4.1968 ms/op 4.1542 ms/op 1.01
compositeListValue.readonlyValuesArray() 29.029 ms/op 27.561 ms/op 1.05
compositeListValue.readonlyValuesArray() + loop all 29.403 ms/op 29.214 ms/op 1.01
Number64UintType - get balances list 4.0677 ms/op 4.3291 ms/op 0.94
Number64UintType - set balances list 8.6330 ms/op 10.021 ms/op 0.86
Number64UintType - get and increase 10 then set 36.651 ms/op 40.389 ms/op 0.91
Number64UintType - increase 10 using applyDelta 15.598 ms/op 17.193 ms/op 0.91
Number64UintType - increase 10 using applyDeltaInBatch 16.336 ms/op 17.224 ms/op 0.95
tree_newTreeFromUint64Deltas 16.441 ms/op 13.377 ms/op 1.23
unsafeUint8ArrayToTree 28.381 ms/op 26.745 ms/op 1.06
bitLength(50) 214.00 ns/op 203.00 ns/op 1.05
bitLengthStr(50) 205.00 ns/op 193.00 ns/op 1.06
bitLength(8000) 209.00 ns/op 197.00 ns/op 1.06
bitLengthStr(8000) 245.00 ns/op 245.00 ns/op 1.00
bitLength(250000) 205.00 ns/op 208.00 ns/op 0.99
bitLengthStr(250000) 276.00 ns/op 297.00 ns/op 0.93
floor - Math.floor (53) 1.2361 ns/op 1.2564 ns/op 0.98
floor - << 0 (53) 1.2370 ns/op 1.2374 ns/op 1.00
floor - Math.floor (512) 1.2422 ns/op 1.2365 ns/op 1.00
floor - << 0 (512) 1.2371 ns/op 1.2364 ns/op 1.00
fnIf(0) 1.5464 ns/op 1.5548 ns/op 0.99
fnSwitch(0) 2.1654 ns/op 2.1661 ns/op 1.00
fnObj(0) 1.5508 ns/op 1.5695 ns/op 0.99
fnArr(0) 1.5464 ns/op 1.5471 ns/op 1.00
fnIf(4) 2.1654 ns/op 2.1932 ns/op 0.99
fnSwitch(4) 2.1656 ns/op 2.1642 ns/op 1.00
fnObj(4) 1.5519 ns/op 1.5485 ns/op 1.00
fnArr(4) 1.5481 ns/op 1.5481 ns/op 1.00
fnIf(9) 3.1158 ns/op 3.0949 ns/op 1.01
fnSwitch(9) 2.1646 ns/op 2.1954 ns/op 0.99
fnObj(9) 1.5553 ns/op 1.5493 ns/op 1.00
fnArr(9) 1.5520 ns/op 1.5497 ns/op 1.00
Container {a,b,vec} - as struct x100000 124.03 us/op 123.91 us/op 1.00
Container {a,b,vec} - as tree x100000 340.65 us/op 340.30 us/op 1.00
Container {a,vec,b} - as struct x100000 155.13 us/op 154.77 us/op 1.00
Container {a,vec,b} - as tree x100000 371.18 us/op 372.12 us/op 1.00
get 2 props x1000000 - rawObject 310.22 us/op 310.81 us/op 1.00
get 2 props x1000000 - proxy 72.744 ms/op 72.741 ms/op 1.00
get 2 props x1000000 - customObj 309.29 us/op 309.33 us/op 1.00
Simple object binary -> struct 664.00 ns/op 795.00 ns/op 0.84
Simple object binary -> tree_backed 1.2600 us/op 1.5580 us/op 0.81
Simple object struct -> tree_backed 1.8050 us/op 2.1900 us/op 0.82
Simple object tree_backed -> struct 1.8080 us/op 2.1540 us/op 0.84
Simple object struct -> binary 917.00 ns/op 1.0830 us/op 0.85
Simple object tree_backed -> binary 1.5480 us/op 1.5820 us/op 0.98
aggregationBits binary -> struct 590.00 ns/op 589.00 ns/op 1.00
aggregationBits binary -> tree_backed 2.3100 us/op 2.3670 us/op 0.98
aggregationBits struct -> tree_backed 2.7500 us/op 2.8010 us/op 0.98
aggregationBits tree_backed -> struct 1.1870 us/op 1.1880 us/op 1.00
aggregationBits struct -> binary 772.00 ns/op 774.00 ns/op 1.00
aggregationBits tree_backed -> binary 1.0280 us/op 1.0300 us/op 1.00
List(uint8) 100000 binary -> struct 1.4430 ms/op 1.4490 ms/op 1.00
List(uint8) 100000 binary -> tree_backed 86.766 us/op 88.515 us/op 0.98
List(uint8) 100000 struct -> tree_backed 1.1157 ms/op 1.1905 ms/op 0.94
List(uint8) 100000 tree_backed -> struct 1.1271 ms/op 1.0591 ms/op 1.06
List(uint8) 100000 struct -> binary 995.09 us/op 1.0094 ms/op 0.99
List(uint8) 100000 tree_backed -> binary 87.099 us/op 87.930 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.1378 ms/op 1.2081 ms/op 0.94
List(uint64Number) 100000 binary -> tree_backed 2.9870 ms/op 3.2269 ms/op 0.93
List(uint64Number) 100000 struct -> tree_backed 4.4194 ms/op 4.8569 ms/op 0.91
List(uint64Number) 100000 tree_backed -> struct 2.1324 ms/op 2.3570 ms/op 0.90
List(uint64Number) 100000 struct -> binary 1.4021 ms/op 1.5680 ms/op 0.89
List(uint64Number) 100000 tree_backed -> binary 849.98 us/op 905.40 us/op 0.94
List(Uint64Bigint) 100000 binary -> struct 3.7439 ms/op 3.6912 ms/op 1.01
List(Uint64Bigint) 100000 binary -> tree_backed 2.7574 ms/op 3.3661 ms/op 0.82
List(Uint64Bigint) 100000 struct -> tree_backed 5.2494 ms/op 5.5335 ms/op 0.95
List(Uint64Bigint) 100000 tree_backed -> struct 4.4240 ms/op 4.6956 ms/op 0.94
List(Uint64Bigint) 100000 struct -> binary 2.0289 ms/op 2.0423 ms/op 0.99
List(Uint64Bigint) 100000 tree_backed -> binary 933.45 us/op 1.1645 ms/op 0.80
Vector(Root) 100000 binary -> struct 29.585 ms/op 31.484 ms/op 0.94
Vector(Root) 100000 binary -> tree_backed 26.093 ms/op 33.719 ms/op 0.77
Vector(Root) 100000 struct -> tree_backed 36.658 ms/op 37.528 ms/op 0.98
Vector(Root) 100000 tree_backed -> struct 42.367 ms/op 45.449 ms/op 0.93
Vector(Root) 100000 struct -> binary 2.5653 ms/op 2.5929 ms/op 0.99
Vector(Root) 100000 tree_backed -> binary 8.7720 ms/op 10.302 ms/op 0.85
List(Validator) 100000 binary -> struct 103.08 ms/op 108.18 ms/op 0.95
List(Validator) 100000 binary -> tree_backed 262.12 ms/op 290.31 ms/op 0.90
List(Validator) 100000 struct -> tree_backed 283.39 ms/op 302.03 ms/op 0.94
List(Validator) 100000 tree_backed -> struct 191.54 ms/op 192.89 ms/op 0.99
List(Validator) 100000 struct -> binary 27.156 ms/op 27.086 ms/op 1.00
List(Validator) 100000 tree_backed -> binary 102.03 ms/op 101.01 ms/op 1.01
List(Validator-NS) 100000 binary -> struct 97.689 ms/op 105.24 ms/op 0.93
List(Validator-NS) 100000 binary -> tree_backed 135.13 ms/op 144.50 ms/op 0.94
List(Validator-NS) 100000 struct -> tree_backed 166.60 ms/op 173.97 ms/op 0.96
List(Validator-NS) 100000 tree_backed -> struct 142.13 ms/op 146.22 ms/op 0.97
List(Validator-NS) 100000 struct -> binary 26.891 ms/op 27.026 ms/op 1.00
List(Validator-NS) 100000 tree_backed -> binary 31.627 ms/op 32.982 ms/op 0.96
get epochStatuses - MutableVector 93.143 us/op 104.84 us/op 0.89
get epochStatuses - ViewDU 206.65 us/op 208.53 us/op 0.99
set epochStatuses - ListTreeView 1.4709 ms/op 1.6046 ms/op 0.92
set epochStatuses - ListTreeView - set() 447.74 us/op 457.65 us/op 0.98
set epochStatuses - ListTreeView - commit() 505.85 us/op 438.80 us/op 1.15
bitstring 641.14 ns/op 645.17 ns/op 0.99
bit mask 13.986 ns/op 14.232 ns/op 0.98
struct - increase slot to 1000000 928.29 us/op 927.45 us/op 1.00
UintNumberType - increase slot to 1000000 23.541 ms/op 23.901 ms/op 0.98
UintBigintType - increase slot to 1000000 160.71 ms/op 200.68 ms/op 0.80
UintBigint8 x 100000 tree_deserialize 4.5679 ms/op 5.2920 ms/op 0.86
UintBigint8 x 100000 tree_serialize 1.0984 ms/op 1.0923 ms/op 1.01
UintBigint16 x 100000 tree_deserialize 4.5260 ms/op 6.1811 ms/op 0.73
UintBigint16 x 100000 tree_serialize 1.1629 ms/op 1.5894 ms/op 0.73
UintBigint32 x 100000 tree_deserialize 4.5787 ms/op 5.8123 ms/op 0.79
UintBigint32 x 100000 tree_serialize 1.1757 ms/op 1.4116 ms/op 0.83
UintBigint64 x 100000 tree_deserialize 5.3161 ms/op 6.5494 ms/op 0.81
UintBigint64 x 100000 tree_serialize 1.5445 ms/op 1.9879 ms/op 0.78
UintBigint8 x 100000 value_deserialize 433.17 us/op 432.99 us/op 1.00
UintBigint8 x 100000 value_serialize 609.69 us/op 708.83 us/op 0.86
UintBigint16 x 100000 value_deserialize 464.59 us/op 464.54 us/op 1.00
UintBigint16 x 100000 value_serialize 671.39 us/op 788.61 us/op 0.85
UintBigint32 x 100000 value_deserialize 432.97 us/op 433.86 us/op 1.00
UintBigint32 x 100000 value_serialize 649.91 us/op 786.64 us/op 0.83
UintBigint64 x 100000 value_deserialize 496.56 us/op 510.50 us/op 0.97
UintBigint64 x 100000 value_serialize 823.29 us/op 1.0409 ms/op 0.79
UintBigint8 x 100000 deserialize 2.9493 ms/op 3.6057 ms/op 0.82
UintBigint8 x 100000 serialize 1.4307 ms/op 1.6029 ms/op 0.89
UintBigint16 x 100000 deserialize 2.9294 ms/op 3.1933 ms/op 0.92
UintBigint16 x 100000 serialize 1.5328 ms/op 1.5637 ms/op 0.98
UintBigint32 x 100000 deserialize 2.8727 ms/op 3.2083 ms/op 0.90
UintBigint32 x 100000 serialize 2.7856 ms/op 2.9506 ms/op 0.94
UintBigint64 x 100000 deserialize 3.9312 ms/op 3.8717 ms/op 1.02
UintBigint64 x 100000 serialize 1.5099 ms/op 1.5096 ms/op 1.00
UintBigint128 x 100000 deserialize 4.9695 ms/op 5.0612 ms/op 0.98
UintBigint128 x 100000 serialize 14.078 ms/op 14.205 ms/op 0.99
UintBigint256 x 100000 deserialize 7.8347 ms/op 8.0662 ms/op 0.97
UintBigint256 x 100000 serialize 42.415 ms/op 42.049 ms/op 1.01
Slice from Uint8Array x25000 1.1400 ms/op 1.1554 ms/op 0.99
Slice from ArrayBuffer x25000 16.274 ms/op 16.639 ms/op 0.98
Slice from ArrayBuffer x25000 + new Uint8Array 17.859 ms/op 18.124 ms/op 0.99
Copy Uint8Array 100000 iterate 1.6578 ms/op 1.6601 ms/op 1.00
Copy Uint8Array 100000 slice 119.40 us/op 130.82 us/op 0.91
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 119.18 us/op 137.70 us/op 0.87
Copy Buffer 100000 Uint8Array.prototype.slice.call 120.18 us/op 130.41 us/op 0.92
Copy Uint8Array 100000 slice + set 167.99 us/op 238.49 us/op 0.70
Copy Uint8Array 100000 subarray + set 119.66 us/op 127.50 us/op 0.94
Copy Uint8Array 100000 slice arrayBuffer 119.26 us/op 130.35 us/op 0.91
Uint64 deserialize 100000 - iterate Uint8Array 1.7545 ms/op 1.8916 ms/op 0.93
Uint64 deserialize 100000 - by Uint32A 1.8387 ms/op 1.9184 ms/op 0.96
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.7737 ms/op 1.9187 ms/op 0.92
Uint64 deserialize 100000 - by DataView.getBigUint64 4.8444 ms/op 5.0542 ms/op 0.96
Uint64 deserialize 100000 - by byte 40.119 ms/op 40.585 ms/op 0.99

by benchmarkbot/action

github-actions[bot] avatar Apr 26 '24 08:04 github-actions[bot]