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: new api to upgrade a tree to new type #405

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Oct 1, 2024

Motivation

Cannot reuse an existing tree when upgrading to new type, see ChainSafe/lodestar#6811

Description

  const newType = new ContainerType(newFields);
  const newView = newType.getView(new Tree(view.upgradeToNewType(newType)));
  const newViewDU = newType.getViewDU(viewDU.upgradeToNewType(newType));

@github-actions github-actions bot added the ssz label Oct 1, 2024
@twoeths twoeths marked this pull request as ready for review October 1, 2024 08:51
@twoeths twoeths requested a review from a team as a code owner October 1, 2024 08:51
Copy link

github-actions bot commented Oct 1, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b2f0681 Previous: b4beed2 Ratio
digestTwoHashObjects 50023 times 48.040 ms/op 47.563 ms/op 1.01
digest64 50023 times 54.478 ms/op 53.231 ms/op 1.02
digest 50023 times 59.268 ms/op 54.726 ms/op 1.08
input length 32 1.3020 us/op 1.2230 us/op 1.06
input length 64 1.5320 us/op 1.3700 us/op 1.12
input length 128 2.5620 us/op 2.2950 us/op 1.12
input length 256 3.7300 us/op 3.4350 us/op 1.09
input length 512 5.8210 us/op 5.5950 us/op 1.04
input length 1024 11.303 us/op 10.736 us/op 1.05
digest 1000000 times 1.0144 s/op 920.41 ms/op 1.10
hashObjectToByteArray 50023 times 1.4295 ms/op 1.4270 ms/op 1.00
byteArrayToHashObject 50023 times 2.5106 ms/op 2.5095 ms/op 1.00
digest64 200092 times 249.84 ms/op 219.30 ms/op 1.14
hash 200092 times using batchHash4UintArray64s 264.36 ms/op 237.94 ms/op 1.11
digest64HashObjects 200092 times 199.47 ms/op 191.47 ms/op 1.04
hash 200092 times using batchHash4HashObjectInputs 218.14 ms/op 199.39 ms/op 1.09
getGindicesAtDepth 4.3130 us/op 4.3020 us/op 1.00
iterateAtDepth 7.6730 us/op 7.6230 us/op 1.01
getGindexBits 455.00 ns/op 478.00 ns/op 0.95
gindexIterator 1.0710 us/op 1.0660 us/op 1.00
HashComputationLevel.push then loop 29.460 ms/op 25.273 ms/op 1.17
HashComputation[] push then loop 50.388 ms/op 47.331 ms/op 1.06
hash 2 Uint8Array 500000 times - as-sha256 549.55 ms/op 538.91 ms/op 1.02
hashTwoObjects 500000 times - as-sha256 504.62 ms/op 496.24 ms/op 1.02
executeHashComputations - as-sha256 51.387 ms/op 46.232 ms/op 1.11
hash 2 Uint8Array 500000 times - noble 1.1413 s/op 1.0572 s/op 1.08
hashTwoObjects 500000 times - noble 1.7163 s/op 1.4922 s/op 1.15
executeHashComputations - noble 43.154 ms/op 40.539 ms/op 1.06
hash 2 Uint8Array 500000 times - hashtree 231.96 ms/op 224.17 ms/op 1.03
hashTwoObjects 500000 times - hashtree 225.48 ms/op 218.75 ms/op 1.03
executeHashComputations - hashtree 12.224 ms/op 10.730 ms/op 1.14
getHashComputations 2.6211 ms/op 2.6966 ms/op 0.97
executeHashComputations 12.295 ms/op 11.069 ms/op 1.11
get root 18.295 ms/op 17.276 ms/op 1.06
getNodeH() x7812.5 avg hindex 15.470 us/op 12.511 us/op 1.24
getNodeH() x7812.5 index 0 6.4360 us/op 6.2320 us/op 1.03
getNodeH() x7812.5 index 7 6.2680 us/op 6.3240 us/op 0.99
getNodeH() x7812.5 index 7 with key array 6.2780 us/op 6.2210 us/op 1.01
new LeafNode() x7812.5 14.671 us/op 14.723 us/op 1.00
getHashComputations 250000 nodes 20.178 ms/op 19.422 ms/op 1.04
batchHash 250000 nodes 93.877 ms/op 88.547 ms/op 1.06
get root 250000 nodes 120.15 ms/op 118.56 ms/op 1.01
getHashComputations 500000 nodes 28.441 ms/op 28.728 ms/op 0.99
batchHash 500000 nodes 164.42 ms/op 142.17 ms/op 1.16
get root 500000 nodes 234.80 ms/op 238.10 ms/op 0.99
getHashComputations 1000000 nodes 63.909 ms/op 70.132 ms/op 0.91
batchHash 1000000 nodes 357.51 ms/op 328.90 ms/op 1.09
get root 1000000 nodes 481.88 ms/op 477.38 ms/op 1.01
multiproof - depth 15, 1 requested leaves 8.2200 us/op 8.1730 us/op 1.01
tree offset multiproof - depth 15, 1 requested leaves 19.978 us/op 18.112 us/op 1.10
compact multiproof - depth 15, 1 requested leaves 3.9490 us/op 3.4020 us/op 1.16
multiproof - depth 15, 2 requested leaves 12.387 us/op 11.860 us/op 1.04
tree offset multiproof - depth 15, 2 requested leaves 24.327 us/op 21.715 us/op 1.12
compact multiproof - depth 15, 2 requested leaves 3.9320 us/op 3.4780 us/op 1.13
multiproof - depth 15, 3 requested leaves 18.900 us/op 16.901 us/op 1.12
tree offset multiproof - depth 15, 3 requested leaves 31.947 us/op 27.903 us/op 1.14
compact multiproof - depth 15, 3 requested leaves 5.6610 us/op 4.2200 us/op 1.34
multiproof - depth 15, 4 requested leaves 24.253 us/op 21.786 us/op 1.11
tree offset multiproof - depth 15, 4 requested leaves 38.722 us/op 35.400 us/op 1.09
compact multiproof - depth 15, 4 requested leaves 6.7290 us/op 5.0270 us/op 1.34
packedRootsBytesToLeafNodes bytes 4000 offset 0 1.8480 us/op 2.0580 us/op 0.90
packedRootsBytesToLeafNodes bytes 4000 offset 1 1.8560 us/op 2.0460 us/op 0.91
packedRootsBytesToLeafNodes bytes 4000 offset 2 1.8710 us/op 2.0460 us/op 0.91
packedRootsBytesToLeafNodes bytes 4000 offset 3 1.8720 us/op 2.0170 us/op 0.93
subtreeFillToContents depth 40 count 250000 44.063 ms/op 39.406 ms/op 1.12
setRoot - gindexBitstring 9.6331 ms/op 9.4713 ms/op 1.02
setRoot - gindex 9.4188 ms/op 9.7799 ms/op 0.96
getRoot - gindexBitstring 2.6888 ms/op 2.3727 ms/op 1.13
getRoot - gindex 3.4529 ms/op 3.2045 ms/op 1.08
getHashObject then setHashObject 10.400 ms/op 10.076 ms/op 1.03
setNodeWithFn 7.7875 ms/op 7.6212 ms/op 1.02
getNodeAtDepth depth 0 x100000 1.1128 ms/op 1.1147 ms/op 1.00
setNodeAtDepth depth 0 x100000 2.4610 ms/op 2.4581 ms/op 1.00
getNodesAtDepth depth 0 x100000 1.0538 ms/op 1.0597 ms/op 0.99
setNodesAtDepth depth 0 x100000 1.5374 ms/op 1.5213 ms/op 1.01
getNodeAtDepth depth 1 x100000 1.1773 ms/op 1.1774 ms/op 1.00
setNodeAtDepth depth 1 x100000 5.2949 ms/op 5.1523 ms/op 1.03
getNodesAtDepth depth 1 x100000 1.1780 ms/op 1.1761 ms/op 1.00
setNodesAtDepth depth 1 x100000 4.6397 ms/op 4.3912 ms/op 1.06
getNodeAtDepth depth 2 x100000 1.4535 ms/op 1.4585 ms/op 1.00
setNodeAtDepth depth 2 x100000 9.0369 ms/op 8.9137 ms/op 1.01
getNodesAtDepth depth 2 x100000 19.294 ms/op 17.966 ms/op 1.07
setNodesAtDepth depth 2 x100000 13.691 ms/op 12.902 ms/op 1.06
tree.getNodesAtDepth - gindexes 9.8666 ms/op 7.2954 ms/op 1.35
tree.getNodesAtDepth - push all nodes 1.9539 ms/op 1.8712 ms/op 1.04
tree.getNodesAtDepth - navigation 237.29 us/op 233.54 us/op 1.02
tree.setNodesAtDepth - indexes 416.58 us/op 389.71 us/op 1.07
set at depth 8 459.00 ns/op 455.00 ns/op 1.01
set at depth 16 628.00 ns/op 584.00 ns/op 1.08
set at depth 32 1.0080 us/op 931.00 ns/op 1.08
iterateNodesAtDepth 8 256 14.434 us/op 13.033 us/op 1.11
getNodesAtDepth 8 256 3.5960 us/op 3.3670 us/op 1.07
iterateNodesAtDepth 16 65536 4.6038 ms/op 4.2538 ms/op 1.08
getNodesAtDepth 16 65536 1.5642 ms/op 1.5348 ms/op 1.02
iterateNodesAtDepth 32 250000 16.567 ms/op 15.465 ms/op 1.07
getNodesAtDepth 32 250000 4.8006 ms/op 4.2977 ms/op 1.12
iterateNodesAtDepth 40 250000 16.009 ms/op 15.075 ms/op 1.06
getNodesAtDepth 40 250000 4.3231 ms/op 4.2544 ms/op 1.02
250000 validators root getter 118.48 ms/op 117.93 ms/op 1.00
250000 validators batchHash() 81.690 ms/op 81.978 ms/op 1.00
250000 validators hashComputations 13.289 ms/op 17.881 ms/op 0.74
bitlist bytes to struct (120,90) 959.00 ns/op 821.00 ns/op 1.17
bitlist bytes to tree (120,90) 3.7200 us/op 3.1870 us/op 1.17
bitlist bytes to struct (2048,2048) 1.3990 us/op 1.1530 us/op 1.21
bitlist bytes to tree (2048,2048) 4.3070 us/op 3.9570 us/op 1.09
ByteListType - deserialize 8.4387 ms/op 7.1776 ms/op 1.18
BasicListType - deserialize 17.654 ms/op 15.106 ms/op 1.17
ByteListType - serialize 10.342 ms/op 7.3920 ms/op 1.40
BasicListType - serialize 11.490 ms/op 10.336 ms/op 1.11
BasicListType - tree_convertToStruct 30.309 ms/op 26.430 ms/op 1.15
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 5.6123 ms/op 4.3451 ms/op 1.29
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.0147 ms/op 4.0176 ms/op 1.00
Array.push len 300000 empty Array - number 8.1706 ms/op 5.7115 ms/op 1.43
Array.set len 300000 from new Array - number 2.1520 ms/op 1.8534 ms/op 1.16
Array.set len 300000 - number 6.3768 ms/op 5.6512 ms/op 1.13
Uint8Array.set len 300000 381.50 us/op 367.16 us/op 1.04
Uint32Array.set len 300000 451.82 us/op 420.72 us/op 1.07
Container({a: uint8, b: uint8}) getViewDU x300000 48.578 ms/op 45.041 ms/op 1.08
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.040 ms/op 10.702 ms/op 1.13
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 219.17 ms/op 198.38 ms/op 1.10
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 291.43 ms/op 230.48 ms/op 1.26
List(Container) len 300000 ViewDU.get(i) 7.1851 ms/op 6.3351 ms/op 1.13
List(Container) len 300000 ViewDU.getReadonly(i) 6.9507 ms/op 6.2013 ms/op 1.12
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 39.848 ms/op 40.398 ms/op 0.99
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 5.7268 ms/op 5.0758 ms/op 1.13
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 6.7438 ms/op 5.9316 ms/op 1.14
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 6.1448 ms/op 5.8203 ms/op 1.06
Array.push len 300000 empty Array - object 7.2356 ms/op 5.8913 ms/op 1.23
Array.set len 300000 from new Array - object 2.1925 ms/op 2.0034 ms/op 1.09
Array.set len 300000 - object 6.5245 ms/op 6.2420 ms/op 1.05
cachePermanentRootStruct no cache 6.0800 us/op 5.1110 us/op 1.19
cachePermanentRootStruct with cache 276.00 ns/op 211.00 ns/op 1.31
epochParticipation len 250000 rws 7813 2.3208 ms/op 2.1637 ms/op 1.07
BeaconState ViewDU hashTreeRoot() vc=200000 105.95 ms/op 101.07 ms/op 1.05
BeaconState ViewDU recursive hash - commit step vc=200000 4.8469 ms/op 3.5608 ms/op 1.36
BeaconState ViewDU validator tree creation vc=10000 37.676 ms/op 33.278 ms/op 1.13
BeaconState ViewDU batchHashTreeRoot vc=200000 97.831 ms/op 89.382 ms/op 1.09
BeaconState ViewDU hashTreeRoot - commit step vc=200000 86.380 ms/op 80.229 ms/op 1.08
BeaconState ViewDU hashTreeRoot - hash step vc=200000 16.381 ms/op 14.314 ms/op 1.14
deserialize Attestation - tree 4.9100 us/op 3.9630 us/op 1.24
deserialize Attestation - struct 2.3280 us/op 1.7580 us/op 1.32
deserialize SignedAggregateAndProof - tree 4.6960 us/op 3.6310 us/op 1.29
deserialize SignedAggregateAndProof - struct 3.6550 us/op 2.9160 us/op 1.25
deserialize SyncCommitteeMessage - tree 1.3340 us/op 1.0250 us/op 1.30
deserialize SyncCommitteeMessage - struct 1.3080 us/op 1.0620 us/op 1.23
deserialize SignedContributionAndProof - tree 2.2930 us/op 2.0080 us/op 1.14
deserialize SignedContributionAndProof - struct 2.9360 us/op 2.1560 us/op 1.36
deserialize SignedBeaconBlock - tree 272.41 us/op 207.08 us/op 1.32
deserialize SignedBeaconBlock - struct 139.09 us/op 114.47 us/op 1.22
BeaconState vc 300000 - deserialize tree 650.25 ms/op 585.06 ms/op 1.11
BeaconState vc 300000 - serialize tree 120.34 ms/op 136.42 ms/op 0.88
BeaconState.historicalRoots vc 300000 - deserialize tree 978.00 ns/op 691.00 ns/op 1.42
BeaconState.historicalRoots vc 300000 - serialize tree 785.00 ns/op 650.00 ns/op 1.21
BeaconState.validators vc 300000 - deserialize tree 611.14 ms/op 566.56 ms/op 1.08
BeaconState.validators vc 300000 - serialize tree 105.45 ms/op 97.294 ms/op 1.08
BeaconState.balances vc 300000 - deserialize tree 25.064 ms/op 23.164 ms/op 1.08
BeaconState.balances vc 300000 - serialize tree 4.9193 ms/op 3.5235 ms/op 1.40
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 580.63 us/op 334.74 us/op 1.73
BeaconState.previousEpochParticipation vc 300000 - serialize tree 290.14 us/op 271.56 us/op 1.07
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 521.18 us/op 335.55 us/op 1.55
BeaconState.currentEpochParticipation vc 300000 - serialize tree 282.31 us/op 274.71 us/op 1.03
BeaconState.inactivityScores vc 300000 - deserialize tree 23.179 ms/op 23.268 ms/op 1.00
BeaconState.inactivityScores vc 300000 - serialize tree 3.7576 ms/op 3.3465 ms/op 1.12
hashTreeRoot Attestation - struct 16.961 us/op 19.610 us/op 0.86
hashTreeRoot Attestation - tree 10.057 us/op 9.0690 us/op 1.11
hashTreeRoot SignedAggregateAndProof - struct 25.236 us/op 24.121 us/op 1.05
hashTreeRoot SignedAggregateAndProof - tree 12.853 us/op 12.891 us/op 1.00
hashTreeRoot SyncCommitteeMessage - struct 6.4380 us/op 6.0570 us/op 1.06
hashTreeRoot SyncCommitteeMessage - tree 3.2130 us/op 3.1200 us/op 1.03
hashTreeRoot SignedContributionAndProof - struct 16.501 us/op 16.609 us/op 0.99
hashTreeRoot SignedContributionAndProof - tree 8.7220 us/op 8.8530 us/op 0.99
hashTreeRoot SignedBeaconBlock - struct 1.5604 ms/op 1.2562 ms/op 1.24
hashTreeRoot SignedBeaconBlock - tree 782.82 us/op 759.84 us/op 1.03
hashTreeRoot Validator - struct 8.3580 us/op 7.5450 us/op 1.11
hashTreeRoot Validator - tree 6.9320 us/op 6.3470 us/op 1.09
BeaconState vc 300000 - hashTreeRoot tree 2.2114 s/op 2.0804 s/op 1.06
BeaconState vc 300000 - batchHashTreeRoot tree 3.8220 s/op 3.2767 s/op 1.17
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 1.0930 us/op 950.00 ns/op 1.15
BeaconState.validators vc 300000 - hashTreeRoot tree 2.2650 s/op 2.0641 s/op 1.10
BeaconState.balances vc 300000 - hashTreeRoot tree 32.579 ms/op 32.841 ms/op 0.99
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 4.0376 ms/op 4.2966 ms/op 0.94
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 4.0271 ms/op 4.1245 ms/op 0.98
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 36.946 ms/op 33.347 ms/op 1.11
hash64 x18 10.972 us/op 9.0690 us/op 1.21
hashTwoObjects x18 8.6330 us/op 8.7140 us/op 0.99
hash64 x1740 897.06 us/op 820.40 us/op 1.09
hashTwoObjects x1740 796.96 us/op 822.67 us/op 0.97
hash64 x2700000 1.3881 s/op 1.2905 s/op 1.08
hashTwoObjects x2700000 1.2286 s/op 1.2732 s/op 0.96
get_exitEpoch - ContainerType 273.00 ns/op 366.00 ns/op 0.75
get_exitEpoch - ContainerNodeStructType 283.00 ns/op 363.00 ns/op 0.78
set_exitEpoch - ContainerType 283.00 ns/op 381.00 ns/op 0.74
set_exitEpoch - ContainerNodeStructType 295.00 ns/op 372.00 ns/op 0.79
get_pubkey - ContainerType 986.00 ns/op 1.3880 us/op 0.71
get_pubkey - ContainerNodeStructType 272.00 ns/op 361.00 ns/op 0.75
hashTreeRoot - ContainerType 500.00 ns/op 614.00 ns/op 0.81
hashTreeRoot - ContainerNodeStructType 511.00 ns/op 645.00 ns/op 0.79
createProof - ContainerType 4.9250 us/op 6.3600 us/op 0.77
createProof - ContainerNodeStructType 24.301 us/op 24.930 us/op 0.97
serialize - ContainerType 2.0570 us/op 1.9060 us/op 1.08
serialize - ContainerNodeStructType 1.5390 us/op 1.4160 us/op 1.09
set_exitEpoch_and_hashTreeRoot - ContainerType 2.5550 us/op 2.7860 us/op 0.92
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 7.6160 us/op 7.1890 us/op 1.06
Array - for of 5.5730 us/op 6.5340 us/op 0.85
Array - for(;;) 5.5180 us/op 6.3540 us/op 0.87
basicListValue.readonlyValuesArray() 4.4771 ms/op 4.1882 ms/op 1.07
basicListValue.readonlyValuesArray() + loop all 5.2826 ms/op 4.3806 ms/op 1.21
compositeListValue.readonlyValuesArray() 28.243 ms/op 30.292 ms/op 0.93
compositeListValue.readonlyValuesArray() + loop all 31.264 ms/op 29.651 ms/op 1.05
Number64UintType - get balances list 5.0135 ms/op 5.5447 ms/op 0.90
Number64UintType - set balances list 10.241 ms/op 10.067 ms/op 1.02
Number64UintType - get and increase 10 then set 41.216 ms/op 39.157 ms/op 1.05
Number64UintType - increase 10 using applyDelta 17.446 ms/op 16.529 ms/op 1.06
Number64UintType - increase 10 using applyDeltaInBatch 18.371 ms/op 17.171 ms/op 1.07
tree_newTreeFromUint64Deltas 15.734 ms/op 16.725 ms/op 0.94
unsafeUint8ArrayToTree 32.952 ms/op 32.415 ms/op 1.02
bitLength(50) 224.00 ns/op 222.00 ns/op 1.01
bitLengthStr(50) 226.00 ns/op 210.00 ns/op 1.08
bitLength(8000) 242.00 ns/op 218.00 ns/op 1.11
bitLengthStr(8000) 262.00 ns/op 251.00 ns/op 1.04
bitLength(250000) 247.00 ns/op 220.00 ns/op 1.12
bitLengthStr(250000) 306.00 ns/op 289.00 ns/op 1.06
floor - Math.floor (53) 1.2377 ns/op 1.2430 ns/op 1.00
floor - << 0 (53) 1.2432 ns/op 1.2366 ns/op 1.01
floor - Math.floor (512) 1.2371 ns/op 1.2373 ns/op 1.00
floor - << 0 (512) 1.2372 ns/op 1.2400 ns/op 1.00
fnIf(0) 1.5659 ns/op 1.5538 ns/op 1.01
fnSwitch(0) 2.1644 ns/op 2.1668 ns/op 1.00
fnObj(0) 1.5495 ns/op 1.5568 ns/op 1.00
fnArr(0) 1.5466 ns/op 1.5465 ns/op 1.00
fnIf(4) 2.1650 ns/op 2.1743 ns/op 1.00
fnSwitch(4) 2.1648 ns/op 2.1669 ns/op 1.00
fnObj(4) 1.5607 ns/op 1.5487 ns/op 1.01
fnArr(4) 1.5468 ns/op 1.5480 ns/op 1.00
fnIf(9) 3.0937 ns/op 3.0924 ns/op 1.00
fnSwitch(9) 2.1671 ns/op 2.1665 ns/op 1.00
fnObj(9) 1.5567 ns/op 1.5475 ns/op 1.01
fnArr(9) 1.5454 ns/op 1.5461 ns/op 1.00
Container {a,b,vec} - as struct x100000 123.96 us/op 123.84 us/op 1.00
Container {a,b,vec} - as tree x100000 340.68 us/op 340.09 us/op 1.00
Container {a,vec,b} - as struct x100000 154.88 us/op 154.32 us/op 1.00
Container {a,vec,b} - as tree x100000 378.08 us/op 371.18 us/op 1.02
get 2 props x1000000 - rawObject 309.45 us/op 309.88 us/op 1.00
get 2 props x1000000 - proxy 74.272 ms/op 72.741 ms/op 1.02
get 2 props x1000000 - customObj 311.30 us/op 307.92 us/op 1.01
Simple object binary -> struct 841.00 ns/op 567.00 ns/op 1.48
Simple object binary -> tree_backed 1.7360 us/op 986.00 ns/op 1.76
Simple object struct -> tree_backed 2.4730 us/op 1.5440 us/op 1.60
Simple object tree_backed -> struct 2.0630 us/op 1.4670 us/op 1.41
Simple object struct -> binary 1.0210 us/op 789.00 ns/op 1.29
Simple object tree_backed -> binary 1.6230 us/op 1.2600 us/op 1.29
aggregationBits binary -> struct 597.00 ns/op 444.00 ns/op 1.34
aggregationBits binary -> tree_backed 2.7930 us/op 1.9550 us/op 1.43
aggregationBits struct -> tree_backed 2.9750 us/op 2.3230 us/op 1.28
aggregationBits tree_backed -> struct 1.2710 us/op 926.00 ns/op 1.37
aggregationBits struct -> binary 809.00 ns/op 686.00 ns/op 1.18
aggregationBits tree_backed -> binary 1.1090 us/op 871.00 ns/op 1.27
List(uint8) 100000 binary -> struct 1.5404 ms/op 1.6812 ms/op 0.92
List(uint8) 100000 binary -> tree_backed 100.60 us/op 93.101 us/op 1.08
List(uint8) 100000 struct -> tree_backed 1.1791 ms/op 1.1024 ms/op 1.07
List(uint8) 100000 tree_backed -> struct 1.1898 ms/op 1.0546 ms/op 1.13
List(uint8) 100000 struct -> binary 1.0274 ms/op 989.83 us/op 1.04
List(uint8) 100000 tree_backed -> binary 91.086 us/op 89.572 us/op 1.02
List(uint64Number) 100000 binary -> struct 1.2764 ms/op 1.1648 ms/op 1.10
List(uint64Number) 100000 binary -> tree_backed 3.1345 ms/op 2.5600 ms/op 1.22
List(uint64Number) 100000 struct -> tree_backed 4.9227 ms/op 4.0852 ms/op 1.21
List(uint64Number) 100000 tree_backed -> struct 2.5290 ms/op 2.0743 ms/op 1.22
List(uint64Number) 100000 struct -> binary 1.5204 ms/op 1.3325 ms/op 1.14
List(uint64Number) 100000 tree_backed -> binary 929.30 us/op 853.53 us/op 1.09
List(Uint64Bigint) 100000 binary -> struct 3.9870 ms/op 3.5539 ms/op 1.12
List(Uint64Bigint) 100000 binary -> tree_backed 3.8271 ms/op 3.2431 ms/op 1.18
List(Uint64Bigint) 100000 struct -> tree_backed 6.0745 ms/op 5.5215 ms/op 1.10
List(Uint64Bigint) 100000 tree_backed -> struct 5.3726 ms/op 4.5138 ms/op 1.19
List(Uint64Bigint) 100000 struct -> binary 2.1072 ms/op 2.0407 ms/op 1.03
List(Uint64Bigint) 100000 tree_backed -> binary 1.1790 ms/op 934.11 us/op 1.26
Vector(Root) 100000 binary -> struct 32.323 ms/op 32.244 ms/op 1.00
Vector(Root) 100000 binary -> tree_backed 36.400 ms/op 27.173 ms/op 1.34
Vector(Root) 100000 struct -> tree_backed 41.984 ms/op 45.955 ms/op 0.91
Vector(Root) 100000 tree_backed -> struct 52.175 ms/op 48.127 ms/op 1.08
Vector(Root) 100000 struct -> binary 2.6364 ms/op 2.6239 ms/op 1.00
Vector(Root) 100000 tree_backed -> binary 11.241 ms/op 8.2375 ms/op 1.36
List(Validator) 100000 binary -> struct 100.66 ms/op 104.93 ms/op 0.96
List(Validator) 100000 binary -> tree_backed 317.69 ms/op 285.76 ms/op 1.11
List(Validator) 100000 struct -> tree_backed 332.62 ms/op 309.56 ms/op 1.07
List(Validator) 100000 tree_backed -> struct 216.29 ms/op 210.31 ms/op 1.03
List(Validator) 100000 struct -> binary 27.209 ms/op 26.723 ms/op 1.02
List(Validator) 100000 tree_backed -> binary 111.11 ms/op 115.26 ms/op 0.96
List(Validator-NS) 100000 binary -> struct 113.04 ms/op 98.543 ms/op 1.15
List(Validator-NS) 100000 binary -> tree_backed 158.95 ms/op 144.42 ms/op 1.10
List(Validator-NS) 100000 struct -> tree_backed 196.28 ms/op 185.09 ms/op 1.06
List(Validator-NS) 100000 tree_backed -> struct 173.24 ms/op 165.67 ms/op 1.05
List(Validator-NS) 100000 struct -> binary 27.278 ms/op 27.056 ms/op 1.01
List(Validator-NS) 100000 tree_backed -> binary 34.007 ms/op 31.887 ms/op 1.07
get epochStatuses - MutableVector 111.31 us/op 106.38 us/op 1.05
get epochStatuses - ViewDU 200.00 us/op 203.15 us/op 0.98
set epochStatuses - ListTreeView 1.7184 ms/op 2.3891 ms/op 0.72
set epochStatuses - ListTreeView - set() 437.53 us/op 459.01 us/op 0.95
set epochStatuses - ListTreeView - commit() 561.31 us/op 555.56 us/op 1.01
bitstring 648.66 ns/op 641.14 ns/op 1.01
bit mask 13.837 ns/op 13.521 ns/op 1.02
struct - increase slot to 1000000 928.05 us/op 927.98 us/op 1.00
UintNumberType - increase slot to 1000000 21.390 ms/op 21.987 ms/op 0.97
UintBigintType - increase slot to 1000000 198.73 ms/op 159.36 ms/op 1.25
UintBigint8 x 100000 tree_deserialize 4.8686 ms/op 4.6560 ms/op 1.05
UintBigint8 x 100000 tree_serialize 1.2481 ms/op 1.0943 ms/op 1.14
UintBigint16 x 100000 tree_deserialize 4.8701 ms/op 4.7401 ms/op 1.03
UintBigint16 x 100000 tree_serialize 1.2818 ms/op 1.2154 ms/op 1.05
UintBigint32 x 100000 tree_deserialize 5.9126 ms/op 5.0010 ms/op 1.18
UintBigint32 x 100000 tree_serialize 1.4581 ms/op 1.2239 ms/op 1.19
UintBigint64 x 100000 tree_deserialize 6.4860 ms/op 5.2174 ms/op 1.24
UintBigint64 x 100000 tree_serialize 1.9634 ms/op 1.5732 ms/op 1.25
UintBigint8 x 100000 value_deserialize 432.80 us/op 521.80 us/op 0.83
UintBigint8 x 100000 value_serialize 740.25 us/op 666.63 us/op 1.11
UintBigint16 x 100000 value_deserialize 463.90 us/op 462.13 us/op 1.00
UintBigint16 x 100000 value_serialize 780.71 us/op 724.99 us/op 1.08
UintBigint32 x 100000 value_deserialize 433.11 us/op 433.07 us/op 1.00
UintBigint32 x 100000 value_serialize 755.96 us/op 698.01 us/op 1.08
UintBigint64 x 100000 value_deserialize 496.18 us/op 495.96 us/op 1.00
UintBigint64 x 100000 value_serialize 968.45 us/op 874.42 us/op 1.11
UintBigint8 x 100000 deserialize 3.7296 ms/op 2.9727 ms/op 1.25
UintBigint8 x 100000 serialize 1.6888 ms/op 1.6040 ms/op 1.05
UintBigint16 x 100000 deserialize 3.7267 ms/op 3.0156 ms/op 1.24
UintBigint16 x 100000 serialize 1.4739 ms/op 1.6335 ms/op 0.90
UintBigint32 x 100000 deserialize 3.6965 ms/op 3.0710 ms/op 1.20
UintBigint32 x 100000 serialize 2.9410 ms/op 2.7979 ms/op 1.05
UintBigint64 x 100000 deserialize 4.3034 ms/op 3.9455 ms/op 1.09
UintBigint64 x 100000 serialize 1.5613 ms/op 1.5557 ms/op 1.00
UintBigint128 x 100000 deserialize 6.1742 ms/op 5.4218 ms/op 1.14
UintBigint128 x 100000 serialize 15.961 ms/op 13.879 ms/op 1.15
UintBigint256 x 100000 deserialize 9.7833 ms/op 8.0535 ms/op 1.21
UintBigint256 x 100000 serialize 46.560 ms/op 41.441 ms/op 1.12
Slice from Uint8Array x25000 1.4556 ms/op 1.2979 ms/op 1.12
Slice from ArrayBuffer x25000 16.626 ms/op 15.006 ms/op 1.11
Slice from ArrayBuffer x25000 + new Uint8Array 18.715 ms/op 16.000 ms/op 1.17
Copy Uint8Array 100000 iterate 1.6557 ms/op 1.6460 ms/op 1.01
Copy Uint8Array 100000 slice 123.53 us/op 116.05 us/op 1.06
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 119.54 us/op 117.91 us/op 1.01
Copy Buffer 100000 Uint8Array.prototype.slice.call 122.91 us/op 117.93 us/op 1.04
Copy Uint8Array 100000 slice + set 210.64 us/op 178.57 us/op 1.18
Copy Uint8Array 100000 subarray + set 133.03 us/op 117.59 us/op 1.13
Copy Uint8Array 100000 slice arrayBuffer 129.49 us/op 116.92 us/op 1.11
Uint64 deserialize 100000 - iterate Uint8Array 1.9777 ms/op 1.8024 ms/op 1.10
Uint64 deserialize 100000 - by Uint32A 2.0906 ms/op 1.7828 ms/op 1.17
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.9824 ms/op 1.7841 ms/op 1.11
Uint64 deserialize 100000 - by DataView.getBigUint64 5.0923 ms/op 5.2553 ms/op 0.97
Uint64 deserialize 100000 - by byte 40.121 ms/op 39.228 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.

LGTM, I refactored slightly to only export the utility function upgradeToNewType

@wemeetagain wemeetagain merged commit a7da328 into master Oct 15, 2024
8 checks passed
@wemeetagain wemeetagain deleted the te/upgrade_to_new_type branch October 15, 2024 21:06
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.

2 participants