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

fix: sliceFrom api #394

Merged
merged 3 commits into from
Aug 19, 2024
Merged

fix: sliceFrom api #394

merged 3 commits into from
Aug 19, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 19, 2024

Motivation

  • sliceFrom() api was implemented with the assumption that this.nodes are fully populated but it's not unless populateAllNodes() is called

Description

  • reproduce the bug in unit test
  • call populateAllNodes() api to fix it

@twoeths twoeths requested a review from a team as a code owner August 19, 2024 06:48
@github-actions github-actions bot added the ssz label Aug 19, 2024
Copy link
Contributor

@ensi321 ensi321 left a comment

Choose a reason for hiding this comment

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

Good catch!

Copy link

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 9d49843 Previous: 216241d Ratio
digestTwoHashObjects 50023 times 48.289 ms/op 48.055 ms/op 1.00
digest64 50023 times 53.655 ms/op 53.724 ms/op 1.00
digest 50023 times 56.251 ms/op 58.633 ms/op 0.96
input length 32 1.2160 us/op 1.2110 us/op 1.00
input length 64 1.3600 us/op 1.3420 us/op 1.01
input length 128 2.3900 us/op 2.3170 us/op 1.03
input length 256 3.4840 us/op 3.4450 us/op 1.01
input length 512 5.7090 us/op 5.5850 us/op 1.02
input length 1024 11.122 us/op 10.692 us/op 1.04
digest 1000000 times 927.72 ms/op 900.56 ms/op 1.03
hashObjectToByteArray 50023 times 1.4517 ms/op 1.4304 ms/op 1.01
byteArrayToHashObject 50023 times 2.4526 ms/op 2.5155 ms/op 0.98
digest64 200092 times 229.52 ms/op 219.90 ms/op 1.04
hash 200092 times using batchHash4UintArray64s 251.16 ms/op 239.78 ms/op 1.05
digest64HashObjects 200092 times 198.16 ms/op 198.18 ms/op 1.00
hash 200092 times using batchHash4HashObjectInputs 218.58 ms/op 213.39 ms/op 1.02
getGindicesAtDepth 4.2810 us/op 4.6200 us/op 0.93
iterateAtDepth 7.6860 us/op 8.5660 us/op 0.90
getGindexBits 475.00 ns/op 475.00 ns/op 1.00
gindexIterator 1.0820 us/op 1.0240 us/op 1.06
HashComputationLevel.push then loop 28.672 ms/op 29.096 ms/op 0.99
HashComputation[] push then loop 50.195 ms/op 50.939 ms/op 0.99
hash 2 Uint8Array 500000 times - as-sha256 547.13 ms/op 549.53 ms/op 1.00
hashTwoObjects 500000 times - as-sha256 502.94 ms/op 504.81 ms/op 1.00
executeHashComputations - as-sha256 48.455 ms/op 47.412 ms/op 1.02
hash 2 Uint8Array 500000 times - noble 1.1066 s/op 1.1710 s/op 0.94
hashTwoObjects 500000 times - noble 1.5719 s/op 1.7832 s/op 0.88
executeHashComputations - noble 41.997 ms/op 42.541 ms/op 0.99
hash 2 Uint8Array 500000 times - hashtree 229.80 ms/op 233.35 ms/op 0.98
hashTwoObjects 500000 times - hashtree 216.52 ms/op 217.59 ms/op 1.00
executeHashComputations - hashtree 11.621 ms/op 11.607 ms/op 1.00
getNodeH() x7812.5 avg hindex 12.065 us/op 12.125 us/op 1.00
getNodeH() x7812.5 index 0 6.2910 us/op 6.2470 us/op 1.01
getNodeH() x7812.5 index 7 6.2730 us/op 6.3750 us/op 0.98
getNodeH() x7812.5 index 7 with key array 6.2380 us/op 6.2800 us/op 0.99
new LeafNode() x7812.5 14.671 us/op 14.685 us/op 1.00
getHashComputations 250000 nodes 19.924 ms/op 19.141 ms/op 1.04
batchHash 250000 nodes 331.52 ms/op 332.68 ms/op 1.00
get root 250000 nodes 837.09 ms/op 961.99 ms/op 0.87
getHashComputations 500000 nodes 29.811 ms/op 30.261 ms/op 0.99
batchHash 500000 nodes 593.76 ms/op 591.00 ms/op 1.00
get root 500000 nodes 1.6460 s/op 1.8744 s/op 0.88
getHashComputations 1000000 nodes 56.023 ms/op 63.327 ms/op 0.88
batchHash 1000000 nodes 1.1939 s/op 1.1619 s/op 1.03
get root 1000000 nodes 3.3136 s/op 3.6316 s/op 0.91
multiproof - depth 15, 1 requested leaves 8.6450 us/op 9.4540 us/op 0.91
tree offset multiproof - depth 15, 1 requested leaves 19.384 us/op 21.383 us/op 0.91
compact multiproof - depth 15, 1 requested leaves 3.5670 us/op 4.3340 us/op 0.82
multiproof - depth 15, 2 requested leaves 11.839 us/op 13.991 us/op 0.85
tree offset multiproof - depth 15, 2 requested leaves 22.863 us/op 25.802 us/op 0.89
compact multiproof - depth 15, 2 requested leaves 3.8210 us/op 4.4970 us/op 0.85
multiproof - depth 15, 3 requested leaves 17.478 us/op 19.772 us/op 0.88
tree offset multiproof - depth 15, 3 requested leaves 29.562 us/op 33.134 us/op 0.89
compact multiproof - depth 15, 3 requested leaves 4.9360 us/op 6.3300 us/op 0.78
multiproof - depth 15, 4 requested leaves 22.379 us/op 25.810 us/op 0.87
tree offset multiproof - depth 15, 4 requested leaves 35.932 us/op 40.417 us/op 0.89
compact multiproof - depth 15, 4 requested leaves 5.7970 us/op 7.2620 us/op 0.80
packedRootsBytesToLeafNodes bytes 4000 offset 0 2.0670 us/op 2.3100 us/op 0.89
packedRootsBytesToLeafNodes bytes 4000 offset 1 2.0140 us/op 2.1400 us/op 0.94
packedRootsBytesToLeafNodes bytes 4000 offset 2 2.0060 us/op 2.3570 us/op 0.85
packedRootsBytesToLeafNodes bytes 4000 offset 3 2.0100 us/op 2.3310 us/op 0.86
subtreeFillToContents depth 40 count 250000 43.755 ms/op 44.019 ms/op 0.99
setRoot - gindexBitstring 8.6687 ms/op 11.148 ms/op 0.78
setRoot - gindex 9.0711 ms/op 13.361 ms/op 0.68
getRoot - gindexBitstring 2.5674 ms/op 2.9702 ms/op 0.86
getRoot - gindex 3.2866 ms/op 3.9876 ms/op 0.82
getHashObject then setHashObject 9.8513 ms/op 13.524 ms/op 0.73
setNodeWithFn 7.4350 ms/op 9.7302 ms/op 0.76
getNodeAtDepth depth 0 x100000 1.1144 ms/op 1.1270 ms/op 0.99
setNodeAtDepth depth 0 x100000 2.4057 ms/op 3.5206 ms/op 0.68
getNodesAtDepth depth 0 x100000 1.0559 ms/op 1.0628 ms/op 0.99
setNodesAtDepth depth 0 x100000 1.5159 ms/op 1.5182 ms/op 1.00
getNodeAtDepth depth 1 x100000 1.1836 ms/op 1.2073 ms/op 0.98
setNodeAtDepth depth 1 x100000 5.1727 ms/op 6.3717 ms/op 0.81
getNodesAtDepth depth 1 x100000 1.1823 ms/op 1.1782 ms/op 1.00
setNodesAtDepth depth 1 x100000 4.4004 ms/op 5.9947 ms/op 0.73
getNodeAtDepth depth 2 x100000 1.4562 ms/op 1.4856 ms/op 0.98
setNodeAtDepth depth 2 x100000 8.9293 ms/op 10.906 ms/op 0.82
getNodesAtDepth depth 2 x100000 19.370 ms/op 21.241 ms/op 0.91
setNodesAtDepth depth 2 x100000 13.328 ms/op 17.009 ms/op 0.78
tree.getNodesAtDepth - gindexes 8.4400 ms/op 10.296 ms/op 0.82
tree.getNodesAtDepth - push all nodes 1.8389 ms/op 2.6176 ms/op 0.70
tree.getNodesAtDepth - navigation 236.58 us/op 234.50 us/op 1.01
tree.setNodesAtDepth - indexes 396.03 us/op 536.75 us/op 0.74
set at depth 8 460.00 ns/op 673.00 ns/op 0.68
set at depth 16 599.00 ns/op 844.00 ns/op 0.71
set at depth 32 927.00 ns/op 1.2330 us/op 0.75
iterateNodesAtDepth 8 256 13.765 us/op 17.299 us/op 0.80
getNodesAtDepth 8 256 3.4740 us/op 3.9720 us/op 0.87
iterateNodesAtDepth 16 65536 4.4263 ms/op 4.8324 ms/op 0.92
getNodesAtDepth 16 65536 1.5107 ms/op 2.0803 ms/op 0.73
iterateNodesAtDepth 32 250000 15.898 ms/op 17.947 ms/op 0.89
getNodesAtDepth 32 250000 4.2547 ms/op 4.3070 ms/op 0.99
iterateNodesAtDepth 40 250000 15.939 ms/op 15.973 ms/op 1.00
getNodesAtDepth 40 250000 4.2525 ms/op 4.2999 ms/op 0.99
250000 validators root getter 830.13 ms/op 885.53 ms/op 0.94
250000 validators batchHash() 295.97 ms/op 305.79 ms/op 0.97
250000 validators hashComputations 14.834 ms/op 18.731 ms/op 0.79
bitlist bytes to struct (120,90) 641.00 ns/op 663.00 ns/op 0.97
bitlist bytes to tree (120,90) 2.6800 us/op 2.7980 us/op 0.96
bitlist bytes to struct (2048,2048) 1.0650 us/op 1.1890 us/op 0.90
bitlist bytes to tree (2048,2048) 3.9560 us/op 4.1550 us/op 0.95
ByteListType - deserialize 7.6148 ms/op 9.1722 ms/op 0.83
BasicListType - deserialize 16.242 ms/op 16.469 ms/op 0.99
ByteListType - serialize 8.2052 ms/op 8.4978 ms/op 0.97
BasicListType - serialize 10.608 ms/op 12.023 ms/op 0.88
BasicListType - tree_convertToStruct 28.389 ms/op 31.202 ms/op 0.91
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.7483 ms/op 4.8480 ms/op 0.98
List[uint8, 68719476736] len 300000 ViewDU.get(i) 3.9646 ms/op 4.1277 ms/op 0.96
Array.push len 300000 empty Array - number 6.9594 ms/op 7.2753 ms/op 0.96
Array.set len 300000 from new Array - number 2.0814 ms/op 2.3804 ms/op 0.87
Array.set len 300000 - number 6.3275 ms/op 6.7391 ms/op 0.94
Uint8Array.set len 300000 395.61 us/op 387.42 us/op 1.02
Uint32Array.set len 300000 523.01 us/op 474.06 us/op 1.10
Container({a: uint8, b: uint8}) getViewDU x300000 58.812 ms/op 56.882 ms/op 1.03
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 11.808 ms/op 11.998 ms/op 0.98
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 209.27 ms/op 227.64 ms/op 0.92
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 270.63 ms/op 306.36 ms/op 0.88
List(Container) len 300000 ViewDU.get(i) 6.8900 ms/op 7.5512 ms/op 0.91
List(Container) len 300000 ViewDU.getReadonly(i) 6.8130 ms/op 6.9315 ms/op 0.98
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 34.676 ms/op 35.248 ms/op 0.98
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.9133 ms/op 7.2180 ms/op 0.82
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.0693 ms/op 7.1979 ms/op 0.84
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.0081 ms/op 6.7843 ms/op 0.89
Array.push len 300000 empty Array - object 6.9122 ms/op 8.0574 ms/op 0.86
Array.set len 300000 from new Array - object 2.1650 ms/op 2.0202 ms/op 1.07
Array.set len 300000 - object 6.5108 ms/op 6.6838 ms/op 0.97
cachePermanentRootStruct no cache 5.6230 us/op 6.0230 us/op 0.93
cachePermanentRootStruct with cache 255.00 ns/op 260.00 ns/op 0.98
epochParticipation len 250000 rws 7813 2.3293 ms/op 2.2748 ms/op 1.02
deserialize Attestation - tree 4.4960 us/op 4.4850 us/op 1.00
deserialize Attestation - struct 2.0190 us/op 1.9450 us/op 1.04
deserialize SignedAggregateAndProof - tree 4.0930 us/op 4.0610 us/op 1.01
deserialize SignedAggregateAndProof - struct 3.5520 us/op 3.3980 us/op 1.05
deserialize SyncCommitteeMessage - tree 1.1540 us/op 1.1340 us/op 1.02
deserialize SyncCommitteeMessage - struct 1.1640 us/op 1.1980 us/op 0.97
deserialize SignedContributionAndProof - tree 2.2520 us/op 2.4410 us/op 0.92
deserialize SignedContributionAndProof - struct 2.4070 us/op 2.5650 us/op 0.94
deserialize SignedBeaconBlock - tree 232.79 us/op 238.94 us/op 0.97
deserialize SignedBeaconBlock - struct 126.49 us/op 138.32 us/op 0.91
BeaconState vc 300000 - deserialize tree 600.89 ms/op 600.99 ms/op 1.00
BeaconState vc 300000 - serialize tree 140.45 ms/op 125.34 ms/op 1.12
BeaconState.historicalRoots vc 300000 - deserialize tree 757.00 ns/op 857.00 ns/op 0.88
BeaconState.historicalRoots vc 300000 - serialize tree 661.00 ns/op 731.00 ns/op 0.90
BeaconState.validators vc 300000 - deserialize tree 533.70 ms/op 557.81 ms/op 0.96
BeaconState.validators vc 300000 - serialize tree 100.11 ms/op 113.52 ms/op 0.88
BeaconState.balances vc 300000 - deserialize tree 20.538 ms/op 21.551 ms/op 0.95
BeaconState.balances vc 300000 - serialize tree 4.3201 ms/op 5.8568 ms/op 0.74
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 578.32 us/op 731.89 us/op 0.79
BeaconState.previousEpochParticipation vc 300000 - serialize tree 291.18 us/op 302.41 us/op 0.96
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 628.76 us/op 709.51 us/op 0.89
BeaconState.currentEpochParticipation vc 300000 - serialize tree 291.20 us/op 301.29 us/op 0.97
BeaconState.inactivityScores vc 300000 - deserialize tree 21.766 ms/op 23.684 ms/op 0.92
BeaconState.inactivityScores vc 300000 - serialize tree 4.4087 ms/op 4.7526 ms/op 0.93
hashTreeRoot Attestation - struct 22.581 us/op 22.667 us/op 1.00
hashTreeRoot Attestation - tree 9.3490 us/op 11.269 us/op 0.83
hashTreeRoot SignedAggregateAndProof - struct 26.458 us/op 31.265 us/op 0.85
hashTreeRoot SignedAggregateAndProof - tree 12.992 us/op 13.073 us/op 0.99
hashTreeRoot SyncCommitteeMessage - struct 6.8570 us/op 7.6010 us/op 0.90
hashTreeRoot SyncCommitteeMessage - tree 3.1370 us/op 3.2940 us/op 0.95
hashTreeRoot SignedContributionAndProof - struct 18.127 us/op 19.896 us/op 0.91
hashTreeRoot SignedContributionAndProof - tree 8.9160 us/op 8.9280 us/op 1.00
hashTreeRoot SignedBeaconBlock - struct 1.4366 ms/op 1.6815 ms/op 0.85
hashTreeRoot SignedBeaconBlock - tree 777.86 us/op 825.60 us/op 0.94
hashTreeRoot Validator - struct 8.6520 us/op 10.065 us/op 0.86
hashTreeRoot Validator - tree 7.2300 us/op 7.8340 us/op 0.92
BeaconState vc 300000 - hashTreeRoot tree 2.1248 s/op 2.2027 s/op 0.96
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.0160 us/op 1.1040 us/op 0.92
BeaconState.validators vc 300000 - hashTreeRoot tree 2.0273 s/op 2.1293 s/op 0.95
BeaconState.balances vc 300000 - hashTreeRoot tree 34.101 ms/op 35.131 ms/op 0.97
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 4.1765 ms/op 4.1544 ms/op 1.01
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 4.1867 ms/op 4.1562 ms/op 1.01
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 34.062 ms/op 33.709 ms/op 1.01
hash64 x18 9.5290 us/op 9.4430 us/op 1.01
hashTwoObjects x18 8.6290 us/op 8.9860 us/op 0.96
hash64 x1740 858.89 us/op 874.86 us/op 0.98
hashTwoObjects x1740 817.65 us/op 820.95 us/op 1.00
hash64 x2700000 1.3488 s/op 1.3658 s/op 0.99
hashTwoObjects x2700000 1.2564 s/op 1.2626 s/op 1.00
get_exitEpoch - ContainerType 243.00 ns/op 282.00 ns/op 0.86
get_exitEpoch - ContainerNodeStructType 210.00 ns/op 272.00 ns/op 0.77
set_exitEpoch - ContainerType 241.00 ns/op 288.00 ns/op 0.84
set_exitEpoch - ContainerNodeStructType 248.00 ns/op 287.00 ns/op 0.86
get_pubkey - ContainerType 866.00 ns/op 969.00 ns/op 0.89
get_pubkey - ContainerNodeStructType 248.00 ns/op 279.00 ns/op 0.89
hashTreeRoot - ContainerType 376.00 ns/op 461.00 ns/op 0.82
hashTreeRoot - ContainerNodeStructType 458.00 ns/op 528.00 ns/op 0.87
createProof - ContainerType 4.1420 us/op 4.8720 us/op 0.85
createProof - ContainerNodeStructType 22.568 us/op 24.055 us/op 0.94
serialize - ContainerType 1.8230 us/op 1.9190 us/op 0.95
serialize - ContainerNodeStructType 1.4480 us/op 1.6450 us/op 0.88
set_exitEpoch_and_hashTreeRoot - ContainerType 2.7550 us/op 2.8440 us/op 0.97
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 7.2050 us/op 7.4870 us/op 0.96
Array - for of 8.1500 us/op 11.639 us/op 0.70
Array - for(;;) 8.2060 us/op 12.120 us/op 0.68
basicListValue.readonlyValuesArray() 4.4095 ms/op 6.0195 ms/op 0.73
basicListValue.readonlyValuesArray() + loop all 4.3670 ms/op 6.2804 ms/op 0.70
compositeListValue.readonlyValuesArray() 30.788 ms/op 30.297 ms/op 1.02
compositeListValue.readonlyValuesArray() + loop all 28.533 ms/op 29.299 ms/op 0.97
Number64UintType - get balances list 4.1724 ms/op 4.6224 ms/op 0.90
Number64UintType - set balances list 9.4215 ms/op 9.7283 ms/op 0.97
Number64UintType - get and increase 10 then set 38.981 ms/op 39.467 ms/op 0.99
Number64UintType - increase 10 using applyDelta 16.022 ms/op 16.447 ms/op 0.97
Number64UintType - increase 10 using applyDeltaInBatch 16.286 ms/op 16.648 ms/op 0.98
tree_newTreeFromUint64Deltas 16.795 ms/op 17.723 ms/op 0.95
unsafeUint8ArrayToTree 31.999 ms/op 32.976 ms/op 0.97
bitLength(50) 246.00 ns/op 261.00 ns/op 0.94
bitLengthStr(50) 230.00 ns/op 237.00 ns/op 0.97
bitLength(8000) 232.00 ns/op 259.00 ns/op 0.90
bitLengthStr(8000) 270.00 ns/op 272.00 ns/op 0.99
bitLength(250000) 239.00 ns/op 257.00 ns/op 0.93
bitLengthStr(250000) 310.00 ns/op 309.00 ns/op 1.00
floor - Math.floor (53) 1.2366 ns/op 1.2376 ns/op 1.00
floor - << 0 (53) 1.2533 ns/op 1.2368 ns/op 1.01
floor - Math.floor (512) 1.2691 ns/op 1.2383 ns/op 1.02
floor - << 0 (512) 1.2557 ns/op 1.2610 ns/op 1.00
fnIf(0) 1.5495 ns/op 1.5468 ns/op 1.00
fnSwitch(0) 2.1972 ns/op 2.1963 ns/op 1.00
fnObj(0) 1.5491 ns/op 1.5557 ns/op 1.00
fnArr(0) 1.5692 ns/op 1.5472 ns/op 1.01
fnIf(4) 2.1637 ns/op 2.1705 ns/op 1.00
fnSwitch(4) 2.1666 ns/op 2.1661 ns/op 1.00
fnObj(4) 1.5515 ns/op 1.5473 ns/op 1.00
fnArr(4) 1.5575 ns/op 1.5588 ns/op 1.00
fnIf(9) 3.0968 ns/op 3.1078 ns/op 1.00
fnSwitch(9) 2.1658 ns/op 2.1663 ns/op 1.00
fnObj(9) 1.5707 ns/op 1.5644 ns/op 1.00
fnArr(9) 1.5459 ns/op 1.5462 ns/op 1.00
Container {a,b,vec} - as struct x100000 124.00 us/op 123.94 us/op 1.00
Container {a,b,vec} - as tree x100000 340.34 us/op 341.56 us/op 1.00
Container {a,vec,b} - as struct x100000 154.87 us/op 157.63 us/op 0.98
Container {a,vec,b} - as tree x100000 372.46 us/op 371.38 us/op 1.00
get 2 props x1000000 - rawObject 314.48 us/op 309.85 us/op 1.01
get 2 props x1000000 - proxy 72.719 ms/op 72.961 ms/op 1.00
get 2 props x1000000 - customObj 309.35 us/op 309.70 us/op 1.00
Simple object binary -> struct 584.00 ns/op 812.00 ns/op 0.72
Simple object binary -> tree_backed 1.0740 us/op 1.4020 us/op 0.77
Simple object struct -> tree_backed 1.5710 us/op 1.8690 us/op 0.84
Simple object tree_backed -> struct 1.5310 us/op 1.8870 us/op 0.81
Simple object struct -> binary 933.00 ns/op 930.00 ns/op 1.00
Simple object tree_backed -> binary 1.3410 us/op 1.6380 us/op 0.82
aggregationBits binary -> struct 485.00 ns/op 595.00 ns/op 0.82
aggregationBits binary -> tree_backed 1.9420 us/op 2.4260 us/op 0.80
aggregationBits struct -> tree_backed 2.3280 us/op 2.6490 us/op 0.88
aggregationBits tree_backed -> struct 1.0410 us/op 1.2170 us/op 0.86
aggregationBits struct -> binary 654.00 ns/op 659.00 ns/op 0.99
aggregationBits tree_backed -> binary 874.00 ns/op 1.0750 us/op 0.81
List(uint8) 100000 binary -> struct 1.3703 ms/op 1.5169 ms/op 0.90
List(uint8) 100000 binary -> tree_backed 89.383 us/op 97.088 us/op 0.92
List(uint8) 100000 struct -> tree_backed 1.1703 ms/op 1.1683 ms/op 1.00
List(uint8) 100000 tree_backed -> struct 1.0111 ms/op 1.0608 ms/op 0.95
List(uint8) 100000 struct -> binary 990.48 us/op 1.0081 ms/op 0.98
List(uint8) 100000 tree_backed -> binary 87.975 us/op 88.948 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.2450 ms/op 1.2350 ms/op 1.01
List(uint64Number) 100000 binary -> tree_backed 2.8367 ms/op 3.2713 ms/op 0.87
List(uint64Number) 100000 struct -> tree_backed 4.5728 ms/op 4.8184 ms/op 0.95
List(uint64Number) 100000 tree_backed -> struct 2.2144 ms/op 2.3193 ms/op 0.95
List(uint64Number) 100000 struct -> binary 1.4267 ms/op 1.5024 ms/op 0.95
List(uint64Number) 100000 tree_backed -> binary 890.43 us/op 905.50 us/op 0.98
List(Uint64Bigint) 100000 binary -> struct 3.7490 ms/op 3.8837 ms/op 0.97
List(Uint64Bigint) 100000 binary -> tree_backed 2.9054 ms/op 3.3741 ms/op 0.86
List(Uint64Bigint) 100000 struct -> tree_backed 5.4463 ms/op 5.3670 ms/op 1.01
List(Uint64Bigint) 100000 tree_backed -> struct 4.4615 ms/op 4.4599 ms/op 1.00
List(Uint64Bigint) 100000 struct -> binary 2.0551 ms/op 2.0397 ms/op 1.01
List(Uint64Bigint) 100000 tree_backed -> binary 923.56 us/op 912.04 us/op 1.01
Vector(Root) 100000 binary -> struct 29.495 ms/op 26.728 ms/op 1.10
Vector(Root) 100000 binary -> tree_backed 30.216 ms/op 29.252 ms/op 1.03
Vector(Root) 100000 struct -> tree_backed 38.140 ms/op 37.011 ms/op 1.03
Vector(Root) 100000 tree_backed -> struct 43.996 ms/op 44.536 ms/op 0.99
Vector(Root) 100000 struct -> binary 2.5669 ms/op 2.4746 ms/op 1.04
Vector(Root) 100000 tree_backed -> binary 9.1997 ms/op 8.8946 ms/op 1.03
List(Validator) 100000 binary -> struct 108.51 ms/op 105.27 ms/op 1.03
List(Validator) 100000 binary -> tree_backed 284.01 ms/op 297.23 ms/op 0.96
List(Validator) 100000 struct -> tree_backed 292.70 ms/op 304.11 ms/op 0.96
List(Validator) 100000 tree_backed -> struct 197.69 ms/op 203.66 ms/op 0.97
List(Validator) 100000 struct -> binary 26.705 ms/op 26.599 ms/op 1.00
List(Validator) 100000 tree_backed -> binary 103.27 ms/op 106.62 ms/op 0.97
List(Validator-NS) 100000 binary -> struct 104.41 ms/op 96.287 ms/op 1.08
List(Validator-NS) 100000 binary -> tree_backed 139.36 ms/op 145.03 ms/op 0.96
List(Validator-NS) 100000 struct -> tree_backed 169.01 ms/op 175.07 ms/op 0.97
List(Validator-NS) 100000 tree_backed -> struct 147.81 ms/op 149.94 ms/op 0.99
List(Validator-NS) 100000 struct -> binary 27.036 ms/op 26.786 ms/op 1.01
List(Validator-NS) 100000 tree_backed -> binary 32.872 ms/op 33.675 ms/op 0.98
get epochStatuses - MutableVector 98.571 us/op 97.885 us/op 1.01
get epochStatuses - ViewDU 204.07 us/op 200.14 us/op 1.02
set epochStatuses - ListTreeView 1.6240 ms/op 1.6461 ms/op 0.99
set epochStatuses - ListTreeView - set() 438.60 us/op 431.83 us/op 1.02
set epochStatuses - ListTreeView - commit() 581.39 us/op 529.25 us/op 1.10
bitstring 643.25 ns/op 638.44 ns/op 1.01
bit mask 14.232 ns/op 13.818 ns/op 1.03
struct - increase slot to 1000000 927.92 us/op 944.65 us/op 0.98
UintNumberType - increase slot to 1000000 21.729 ms/op 21.680 ms/op 1.00
UintBigintType - increase slot to 1000000 179.64 ms/op 193.60 ms/op 0.93
UintBigint8 x 100000 tree_deserialize 5.5222 ms/op 4.8329 ms/op 1.14
UintBigint8 x 100000 tree_serialize 1.0963 ms/op 1.0930 ms/op 1.00
UintBigint16 x 100000 tree_deserialize 4.6302 ms/op 4.8685 ms/op 0.95
UintBigint16 x 100000 tree_serialize 1.2189 ms/op 1.2655 ms/op 0.96
UintBigint32 x 100000 tree_deserialize 4.7338 ms/op 4.9914 ms/op 0.95
UintBigint32 x 100000 tree_serialize 1.2082 ms/op 1.3011 ms/op 0.93
UintBigint64 x 100000 tree_deserialize 5.3977 ms/op 5.3148 ms/op 1.02
UintBigint64 x 100000 tree_serialize 1.5670 ms/op 1.7339 ms/op 0.90
UintBigint8 x 100000 value_deserialize 433.54 us/op 433.07 us/op 1.00
UintBigint8 x 100000 value_serialize 644.95 us/op 645.88 us/op 1.00
UintBigint16 x 100000 value_deserialize 468.88 us/op 464.40 us/op 1.01
UintBigint16 x 100000 value_serialize 700.22 us/op 725.62 us/op 0.96
UintBigint32 x 100000 value_deserialize 433.34 us/op 433.84 us/op 1.00
UintBigint32 x 100000 value_serialize 665.64 us/op 687.77 us/op 0.97
UintBigint64 x 100000 value_deserialize 496.58 us/op 497.01 us/op 1.00
UintBigint64 x 100000 value_serialize 854.32 us/op 899.15 us/op 0.95
UintBigint8 x 100000 deserialize 3.0721 ms/op 3.3365 ms/op 0.92
UintBigint8 x 100000 serialize 1.5169 ms/op 1.7853 ms/op 0.85
UintBigint16 x 100000 deserialize 3.1084 ms/op 3.0754 ms/op 1.01
UintBigint16 x 100000 serialize 1.5439 ms/op 1.4434 ms/op 1.07
UintBigint32 x 100000 deserialize 3.1012 ms/op 3.1977 ms/op 0.97
UintBigint32 x 100000 serialize 2.7625 ms/op 2.7317 ms/op 1.01
UintBigint64 x 100000 deserialize 3.9203 ms/op 3.8145 ms/op 1.03
UintBigint64 x 100000 serialize 1.5035 ms/op 1.5096 ms/op 1.00
UintBigint128 x 100000 deserialize 5.3228 ms/op 5.4077 ms/op 0.98
UintBigint128 x 100000 serialize 15.317 ms/op 15.386 ms/op 1.00
UintBigint256 x 100000 deserialize 7.8573 ms/op 8.4454 ms/op 0.93
UintBigint256 x 100000 serialize 46.006 ms/op 44.021 ms/op 1.05
Slice from Uint8Array x25000 1.1366 ms/op 1.1610 ms/op 0.98
Slice from ArrayBuffer x25000 16.191 ms/op 16.908 ms/op 0.96
Slice from ArrayBuffer x25000 + new Uint8Array 17.590 ms/op 18.692 ms/op 0.94
Copy Uint8Array 100000 iterate 1.6565 ms/op 1.6639 ms/op 1.00
Copy Uint8Array 100000 slice 120.84 us/op 102.91 us/op 1.17
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 122.11 us/op 105.49 us/op 1.16
Copy Buffer 100000 Uint8Array.prototype.slice.call 122.94 us/op 113.00 us/op 1.09
Copy Uint8Array 100000 slice + set 198.75 us/op 198.94 us/op 1.00
Copy Uint8Array 100000 subarray + set 122.42 us/op 122.20 us/op 1.00
Copy Uint8Array 100000 slice arrayBuffer 126.44 us/op 122.14 us/op 1.04
Uint64 deserialize 100000 - iterate Uint8Array 1.8561 ms/op 1.8912 ms/op 0.98
Uint64 deserialize 100000 - by Uint32A 1.8629 ms/op 1.8859 ms/op 0.99
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.8165 ms/op 1.9074 ms/op 0.95
Uint64 deserialize 100000 - by DataView.getBigUint64 4.9831 ms/op 5.0279 ms/op 0.99
Uint64 deserialize 100000 - by byte 40.206 ms/op 40.127 ms/op 1.00

by benchmarkbot/action

@wemeetagain wemeetagain merged commit 4ca1d6f into master Aug 19, 2024
8 checks passed
@wemeetagain wemeetagain deleted the te/fix_slice_from branch August 19, 2024 14:35
@twoeths
Copy link
Contributor Author

twoeths commented Sep 30, 2024

the issue did not happen in lodestar because we always get all nodes before calling sliceFrom https://github.com/ChainSafe/lodestar/blob/d69d809e7ab5d5a2cf5030429e83b6af1d5af31a/packages/state-transition/src/epoch/processPendingBalanceDeposits.ts#L24

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.

4 participants