ChainSafe / ssz

Typescript implementation of Simple Serialize (SSZ)
https://simpleserialize.com/
Other
44 stars 17 forks source link

feat: new type for list of uint64 #352

Closed twoeths closed 4 months ago

twoeths commented 4 months ago

Motivation

Description

part of https://github.com/ChainSafe/lodestar/issues/6520

github-actions[bot] commented 4 months ago

Performance Report

✔️ no performance regression detected

Full benchmark results | Benchmark suite | Current: caa276857173224e75bcf68e02348f122b0296b2 | Previous: 14c4457026a9fbea5bfe5c66580f7c8a8bee790a | Ratio | |-|-|-|-| | digestTwoHashObjects 50023 times | 47.674 ms/op | 48.065 ms/op | 0.99 | | digest64 50023 times | 49.297 ms/op | 48.664 ms/op | 1.01 | | digest 50023 times | 49.727 ms/op | 48.850 ms/op | 1.02 | | input length 32 | 1.1950 us/op | 1.1640 us/op | 1.03 | | input length 64 | 1.2560 us/op | 1.2600 us/op | 1.00 | | input length 128 | 2.2620 us/op | 2.2230 us/op | 1.02 | | input length 256 | 3.3200 us/op | 3.3090 us/op | 1.00 | | input length 512 | 5.4120 us/op | 5.4790 us/op | 0.99 | | input length 1024 | 10.908 us/op | 10.791 us/op | 1.01 | | digest 1000000 times | 817.15 ms/op | 799.66 ms/op | 1.02 | | hashObjectToByteArray 50023 times | 1.4462 ms/op | 1.4274 ms/op | 1.01 | | byteArrayToHashObject 50023 times | 1.6698 ms/op | 1.6548 ms/op | 1.01 | | getGindicesAtDepth | 3.9270 us/op | 3.8600 us/op | 1.02 | | iterateAtDepth | 8.7130 us/op | 8.5150 us/op | 1.02 | | getGindexBits | 429.00 ns/op | 421.00 ns/op | 1.02 | | gindexIterator | 951.00 ns/op | 933.00 ns/op | 1.02 | | hash 2 Uint8Array 2250026 times - as-sha256 | 2.2518 s/op | 2.2362 s/op | 1.01 | | hashTwoObjects 2250026 times - as-sha256 | 2.1507 s/op | 2.1564 s/op | 1.00 | | hash 2 Uint8Array 2250026 times - noble | 4.9551 s/op | 4.7406 s/op | 1.05 | | hashTwoObjects 2250026 times - noble | 7.1843 s/op | 6.7332 s/op | 1.07 | | getNodeH() x7812.5 avg hindex | 14.582 us/op | 14.409 us/op | 1.01 | | getNodeH() x7812.5 index 0 | 5.1790 us/op | 5.1250 us/op | 1.01 | | getNodeH() x7812.5 index 7 | 5.1010 us/op | 5.1680 us/op | 0.99 | | getNodeH() x7812.5 index 7 with key array | 5.2180 us/op | 5.1390 us/op | 1.02 | | new LeafNode() x7812.5 | 113.14 us/op | 111.39 us/op | 1.02 | | multiproof - depth 15, 1 requested leaves | 9.2450 us/op | 9.3550 us/op | 0.99 | | tree offset multiproof - depth 15, 1 requested leaves | 20.624 us/op | 20.399 us/op | 1.01 | | compact multiproof - depth 15, 1 requested leaves | 5.6590 us/op | 4.4130 us/op | 1.28 | | multiproof - depth 15, 2 requested leaves | 13.240 us/op | 12.830 us/op | 1.03 | | tree offset multiproof - depth 15, 2 requested leaves | 23.432 us/op | 22.875 us/op | 1.02 | | compact multiproof - depth 15, 2 requested leaves | 3.3410 us/op | 3.3090 us/op | 1.01 | | multiproof - depth 15, 3 requested leaves | 18.895 us/op | 18.287 us/op | 1.03 | | tree offset multiproof - depth 15, 3 requested leaves | 30.532 us/op | 30.574 us/op | 1.00 | | compact multiproof - depth 15, 3 requested leaves | 4.7560 us/op | 4.4640 us/op | 1.07 | | multiproof - depth 15, 4 requested leaves | 24.398 us/op | 24.365 us/op | 1.00 | | tree offset multiproof - depth 15, 4 requested leaves | 37.545 us/op | 37.778 us/op | 0.99 | | compact multiproof - depth 15, 4 requested leaves | 5.5110 us/op | 5.2210 us/op | 1.06 | | packedRootsBytesToLeafNodes bytes 4000 offset 0 | 2.0320 us/op | 1.9800 us/op | 1.03 | | packedRootsBytesToLeafNodes bytes 4000 offset 1 | 2.0340 us/op | 1.9590 us/op | 1.04 | | packedRootsBytesToLeafNodes bytes 4000 offset 2 | 2.0290 us/op | 1.9800 us/op | 1.02 | | packedRootsBytesToLeafNodes bytes 4000 offset 3 | 2.0750 us/op | 1.9560 us/op | 1.06 | | subtreeFillToContents depth 40 count 250000 | 40.874 ms/op | 39.368 ms/op | 1.04 | | setRoot - gindexBitstring | 9.0412 ms/op | 8.5172 ms/op | 1.06 | | setRoot - gindex | 10.329 ms/op | 9.0764 ms/op | 1.14 | | getRoot - gindexBitstring | 2.6159 ms/op | 2.5640 ms/op | 1.02 | | getRoot - gindex | 3.1549 ms/op | 3.1508 ms/op | 1.00 | | getHashObject then setHashObject | 10.552 ms/op | 10.166 ms/op | 1.04 | | setNodeWithFn | 9.4518 ms/op | 9.0640 ms/op | 1.04 | | getNodeAtDepth depth 0 x100000 | 1.1755 ms/op | 1.1438 ms/op | 1.03 | | setNodeAtDepth depth 0 x100000 | 2.6447 ms/op | 2.5510 ms/op | 1.04 | | getNodesAtDepth depth 0 x100000 | 1.0837 ms/op | 1.0842 ms/op | 1.00 | | setNodesAtDepth depth 0 x100000 | 1.4848 ms/op | 1.4858 ms/op | 1.00 | | getNodeAtDepth depth 1 x100000 | 1.2073 ms/op | 1.2074 ms/op | 1.00 | | setNodeAtDepth depth 1 x100000 | 5.9966 ms/op | 5.7563 ms/op | 1.04 | | getNodesAtDepth depth 1 x100000 | 1.2080 ms/op | 1.2102 ms/op | 1.00 | | setNodesAtDepth depth 1 x100000 | 4.9783 ms/op | 4.7858 ms/op | 1.04 | | getNodeAtDepth depth 2 x100000 | 1.4828 ms/op | 1.4851 ms/op | 1.00 | | setNodeAtDepth depth 2 x100000 | 10.090 ms/op | 10.353 ms/op | 0.97 | | getNodesAtDepth depth 2 x100000 | 20.679 ms/op | 20.052 ms/op | 1.03 | | setNodesAtDepth depth 2 x100000 | 14.098 ms/op | 15.723 ms/op | 0.90 | | tree.getNodesAtDepth - gindexes | 6.5958 ms/op | 6.6621 ms/op | 0.99 | | tree.getNodesAtDepth - push all nodes | 2.2292 ms/op | 2.1262 ms/op | 1.05 | | tree.getNodesAtDepth - navigation | 161.37 us/op | 159.47 us/op | 1.01 | | tree.setNodesAtDepth - indexes | 402.92 us/op | 373.75 us/op | 1.08 | | set at depth 8 | 559.00 ns/op | 502.00 ns/op | 1.11 | | set at depth 16 | 731.00 ns/op | 654.00 ns/op | 1.12 | | set at depth 32 | 1.0770 us/op | 1.0130 us/op | 1.06 | | iterateNodesAtDepth 8 256 | 14.442 us/op | 15.787 us/op | 0.91 | | getNodesAtDepth 8 256 | 3.5160 us/op | 3.3960 us/op | 1.04 | | iterateNodesAtDepth 16 65536 | 4.6195 ms/op | 4.7877 ms/op | 0.96 | | getNodesAtDepth 16 65536 | 2.0385 ms/op | 1.9030 ms/op | 1.07 | | iterateNodesAtDepth 32 250000 | 17.076 ms/op | 17.954 ms/op | 0.95 | | getNodesAtDepth 32 250000 | 4.7187 ms/op | 4.5617 ms/op | 1.03 | | iterateNodesAtDepth 40 250000 | 16.427 ms/op | 17.781 ms/op | 0.92 | | getNodesAtDepth 40 250000 | 4.7447 ms/op | 4.5609 ms/op | 1.04 | | 250k validators | 7.8643 s/op | 7.5290 s/op | 1.04 | | bitlist bytes to struct (120,90) | 911.00 ns/op | 631.00 ns/op | 1.44 | | bitlist bytes to tree (120,90) | 2.4330 us/op | 2.4810 us/op | 0.98 | | bitlist bytes to struct (2048,2048) | 1.0550 us/op | 1.0710 us/op | 0.99 | | bitlist bytes to tree (2048,2048) | 3.8760 us/op | 3.8530 us/op | 1.01 | | ByteListType - deserialize | 7.8493 ms/op | 8.0300 ms/op | 0.98 | | BasicListType - deserialize | 9.7162 ms/op | 9.2722 ms/op | 1.05 | | ByteListType - serialize | 7.8136 ms/op | 8.2821 ms/op | 0.94 | | BasicListType - serialize | 10.680 ms/op | 10.934 ms/op | 0.98 | | BasicListType - tree_convertToStruct | 24.027 ms/op | 23.362 ms/op | 1.03 | | List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate | 4.0949 ms/op | 4.2532 ms/op | 0.96 | | List[uint8, 68719476736] len 300000 ViewDU.get(i) | 4.1416 ms/op | 4.1441 ms/op | 1.00 | | Array.push len 300000 empty Array - number | 6.3236 ms/op | 6.2390 ms/op | 1.01 | | Array.set len 300000 from new Array - number | 1.6119 ms/op | 1.5957 ms/op | 1.01 | | Array.set len 300000 - number | 5.7391 ms/op | 5.1734 ms/op | 1.11 | | Uint8Array.set len 300000 | 216.49 us/op | 211.81 us/op | 1.02 | | Uint32Array.set len 300000 | 306.85 us/op | 284.65 us/op | 1.08 | | Container({a: uint8, b: uint8}) getViewDU x300000 | 20.664 ms/op | 19.899 ms/op | 1.04 | | ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 | 9.7708 ms/op | 9.2207 ms/op | 1.06 | | List(Container) len 300000 ViewDU.getAllReadonly() + iterate | 212.33 ms/op | 209.18 ms/op | 1.02 | | List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate | 287.46 ms/op | 296.48 ms/op | 0.97 | | List(Container) len 300000 ViewDU.get(i) | 6.6739 ms/op | 6.3656 ms/op | 1.05 | | List(Container) len 300000 ViewDU.getReadonly(i) | 6.6000 ms/op | 6.2410 ms/op | 1.06 | | List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate | 34.463 ms/op | 36.206 ms/op | 0.95 | | List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate | 5.6776 ms/op | 5.2422 ms/op | 1.08 | | List(ContainerNodeStruct) len 300000 ViewDU.get(i) | 6.2148 ms/op | 5.9607 ms/op | 1.04 | | List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) | 5.9380 ms/op | 5.8236 ms/op | 1.02 | | Array.push len 300000 empty Array - object | 6.6850 ms/op | 5.9937 ms/op | 1.12 | | Array.set len 300000 from new Array - object | 2.1209 ms/op | 1.9119 ms/op | 1.11 | | Array.set len 300000 - object | 5.9795 ms/op | 6.1610 ms/op | 0.97 | | cachePermanentRootStruct no cache | 9.2670 us/op | 8.6480 us/op | 1.07 | | cachePermanentRootStruct with cache | 204.00 ns/op | 213.00 ns/op | 0.96 | | epochParticipation len 250000 rws 7813 | 2.2072 ms/op | 2.2801 ms/op | 0.97 | | deserialize Attestation - tree | 2.7810 us/op | 3.2170 us/op | 0.86 | | deserialize Attestation - struct | 1.8740 us/op | 2.0820 us/op | 0.90 | | deserialize SignedAggregateAndProof - tree | 3.5200 us/op | 3.6060 us/op | 0.98 | | deserialize SignedAggregateAndProof - struct | 2.9350 us/op | 3.0420 us/op | 0.96 | | deserialize SyncCommitteeMessage - tree | 1.1020 us/op | 1.1750 us/op | 0.94 | | deserialize SyncCommitteeMessage - struct | 1.1450 us/op | 1.2250 us/op | 0.93 | | deserialize SignedContributionAndProof - tree | 1.9100 us/op | 1.9430 us/op | 0.98 | | deserialize SignedContributionAndProof - struct | 2.4230 us/op | 2.4660 us/op | 0.98 | | deserialize SignedBeaconBlock - tree | 208.65 us/op | 210.10 us/op | 0.99 | | deserialize SignedBeaconBlock - struct | 121.69 us/op | 122.17 us/op | 1.00 | | BeaconState vc 300000 - deserialize tree | 607.28 ms/op | 603.89 ms/op | 1.01 | | BeaconState vc 300000 - serialize tree | 144.00 ms/op | 144.99 ms/op | 0.99 | | BeaconState.historicalRoots vc 300000 - deserialize tree | 866.00 ns/op | 829.00 ns/op | 1.04 | | BeaconState.historicalRoots vc 300000 - serialize tree | 784.00 ns/op | 799.00 ns/op | 0.98 | | BeaconState.validators vc 300000 - deserialize tree | 543.28 ms/op | 554.55 ms/op | 0.98 | | BeaconState.validators vc 300000 - serialize tree | 141.87 ms/op | 147.16 ms/op | 0.96 | | BeaconState.balances vc 300000 - deserialize tree | 20.839 ms/op | 20.539 ms/op | 1.01 | | BeaconState.balances vc 300000 - serialize tree | 3.6063 ms/op | 4.0953 ms/op | 0.88 | | BeaconState.previousEpochParticipation vc 300000 - deserialize tree | 461.49 us/op | 599.09 us/op | 0.77 | | BeaconState.previousEpochParticipation vc 300000 - serialize tree | 274.75 us/op | 275.36 us/op | 1.00 | | BeaconState.currentEpochParticipation vc 300000 - deserialize tree | 445.07 us/op | 569.83 us/op | 0.78 | | BeaconState.currentEpochParticipation vc 300000 - serialize tree | 273.88 us/op | 274.37 us/op | 1.00 | | BeaconState.inactivityScores vc 300000 - deserialize tree | 21.128 ms/op | 20.824 ms/op | 1.01 | | BeaconState.inactivityScores vc 300000 - serialize tree | 3.4842 ms/op | 3.0102 ms/op | 1.16 | | hashTreeRoot Attestation - struct | 31.934 us/op | 27.035 us/op | 1.18 | | hashTreeRoot Attestation - tree | 18.368 us/op | 19.708 us/op | 0.93 | | hashTreeRoot SignedAggregateAndProof - struct | 42.204 us/op | 38.885 us/op | 1.09 | | hashTreeRoot SignedAggregateAndProof - tree | 28.274 us/op | 27.724 us/op | 1.02 | | hashTreeRoot SyncCommitteeMessage - struct | 10.395 us/op | 9.1540 us/op | 1.14 | | hashTreeRoot SyncCommitteeMessage - tree | 6.2360 us/op | 6.2130 us/op | 1.00 | | hashTreeRoot SignedContributionAndProof - struct | 28.734 us/op | 26.128 us/op | 1.10 | | hashTreeRoot SignedContributionAndProof - tree | 20.269 us/op | 19.460 us/op | 1.04 | | hashTreeRoot SignedBeaconBlock - struct | 2.3479 ms/op | 2.3208 ms/op | 1.01 | | hashTreeRoot SignedBeaconBlock - tree | 1.6737 ms/op | 1.6666 ms/op | 1.00 | | hashTreeRoot Validator - struct | 13.381 us/op | 12.914 us/op | 1.04 | | hashTreeRoot Validator - tree | 11.276 us/op | 11.019 us/op | 1.02 | | BeaconState vc 300000 - hashTreeRoot tree | 3.6661 s/op | 3.6900 s/op | 0.99 | | BeaconState.historicalRoots vc 300000 - hashTreeRoot tree | 1.5740 us/op | 1.5260 us/op | 1.03 | | BeaconState.validators vc 300000 - hashTreeRoot tree | 3.5236 s/op | 3.5851 s/op | 0.98 | | BeaconState.balances vc 300000 - hashTreeRoot tree | 88.335 ms/op | 84.735 ms/op | 1.04 | | BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree | 8.9622 ms/op | 9.0065 ms/op | 1.00 | | BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree | 8.9766 ms/op | 9.0226 ms/op | 0.99 | | BeaconState.inactivityScores vc 300000 - hashTreeRoot tree | 82.196 ms/op | 88.197 ms/op | 0.93 | | hash64 x18 | 19.751 us/op | 19.458 us/op | 1.02 | | hashTwoObjects x18 | 17.965 us/op | 18.181 us/op | 0.99 | | hash64 x1740 | 1.8416 ms/op | 1.8439 ms/op | 1.00 | | hashTwoObjects x1740 | 1.7102 ms/op | 1.6973 ms/op | 1.01 | | hash64 x2700000 | 2.8637 s/op | 2.8515 s/op | 1.00 | | hashTwoObjects x2700000 | 2.6550 s/op | 2.6420 s/op | 1.00 | | get_exitEpoch - ContainerType | 209.00 ns/op | 214.00 ns/op | 0.98 | | get_exitEpoch - ContainerNodeStructType | 206.00 ns/op | 216.00 ns/op | 0.95 | | set_exitEpoch - ContainerType | 260.00 ns/op | 256.00 ns/op | 1.02 | | set_exitEpoch - ContainerNodeStructType | 225.00 ns/op | 242.00 ns/op | 0.93 | | get_pubkey - ContainerType | 1.0930 us/op | 1.2390 us/op | 0.88 | | get_pubkey - ContainerNodeStructType | 214.00 ns/op | 233.00 ns/op | 0.92 | | hashTreeRoot - ContainerType | 403.00 ns/op | 451.00 ns/op | 0.89 | | hashTreeRoot - ContainerNodeStructType | 444.00 ns/op | 492.00 ns/op | 0.90 | | createProof - ContainerType | 4.1100 us/op | 4.0570 us/op | 1.01 | | createProof - ContainerNodeStructType | 23.187 us/op | 23.408 us/op | 0.99 | | serialize - ContainerType | 2.0830 us/op | 2.1380 us/op | 0.97 | | serialize - ContainerNodeStructType | 1.5550 us/op | 1.6530 us/op | 0.94 | | set_exitEpoch_and_hashTreeRoot - ContainerType | 4.4350 us/op | 4.2750 us/op | 1.04 | | set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType | 11.502 us/op | 11.593 us/op | 0.99 | | Array - for of | 5.5890 us/op | 6.1060 us/op | 0.92 | | Array - for(;;) | 4.9710 us/op | 5.4370 us/op | 0.91 | | basicListValue.readonlyValuesArray() | 3.9992 ms/op | 3.8111 ms/op | 1.05 | | basicListValue.readonlyValuesArray() + loop all | 3.9315 ms/op | 3.7721 ms/op | 1.04 | | compositeListValue.readonlyValuesArray() | 29.753 ms/op | 27.051 ms/op | 1.10 | | compositeListValue.readonlyValuesArray() + loop all | 25.648 ms/op | 22.815 ms/op | 1.12 | | Number64UintType - get balances list | 4.1229 ms/op | 4.5024 ms/op | 0.92 | | Number64UintType - set balances list | 8.8590 ms/op | 9.2937 ms/op | 0.95 | | Number64UintType - get and increase 10 then set | 38.833 ms/op | 37.507 ms/op | 1.04 | | Number64UintType - increase 10 using applyDelta | 16.304 ms/op | 15.427 ms/op | 1.06 | | Number64UintType - increase 10 using applyDeltaInBatch | 15.516 ms/op | 16.109 ms/op | 0.96 | | tree_newTreeFromUint64Deltas | 15.689 ms/op | 16.340 ms/op | 0.96 | | unsafeUint8ArrayToTree | 30.331 ms/op | 33.060 ms/op | 0.92 | | bitLength(50) | 222.00 ns/op | 231.00 ns/op | 0.96 | | bitLengthStr(50) | 231.00 ns/op | 233.00 ns/op | 0.99 | | bitLength(8000) | 222.00 ns/op | 218.00 ns/op | 1.02 | | bitLengthStr(8000) | 273.00 ns/op | 279.00 ns/op | 0.98 | | bitLength(250000) | 217.00 ns/op | 219.00 ns/op | 0.99 | | bitLengthStr(250000) | 320.00 ns/op | 317.00 ns/op | 1.01 | | floor - Math.floor (53) | 0.46496 ns/op | 0.46511 ns/op | 1.00 | | floor - << 0 (53) | 0.46496 ns/op | 0.46675 ns/op | 1.00 | | floor - Math.floor (512) | 0.47306 ns/op | 0.46467 ns/op | 1.02 | | floor - << 0 (512) | 0.46547 ns/op | 0.46652 ns/op | 1.00 | | fnIf(0) | 1.5463 ns/op | 1.5460 ns/op | 1.00 | | fnSwitch(0) | 2.4730 ns/op | 2.4739 ns/op | 1.00 | | fnObj(0) | 0.46490 ns/op | 0.46596 ns/op | 1.00 | | fnArr(0) | 0.46570 ns/op | 0.46672 ns/op | 1.00 | | fnIf(4) | 2.1640 ns/op | 2.1672 ns/op | 1.00 | | fnSwitch(4) | 2.4745 ns/op | 2.4744 ns/op | 1.00 | | fnObj(4) | 0.46557 ns/op | 0.46520 ns/op | 1.00 | | fnArr(4) | 0.46394 ns/op | 0.46441 ns/op | 1.00 | | fnIf(9) | 3.0929 ns/op | 3.0955 ns/op | 1.00 | | fnSwitch(9) | 2.4737 ns/op | 2.4747 ns/op | 1.00 | | fnObj(9) | 0.46905 ns/op | 0.46414 ns/op | 1.01 | | fnArr(9) | 0.46917 ns/op | 0.46632 ns/op | 1.01 | | Container {a,b,vec} - as struct x100000 | 47.869 us/op | 46.807 us/op | 1.02 | | Container {a,b,vec} - as tree x100000 | 373.24 us/op | 371.61 us/op | 1.00 | | Container {a,vec,b} - as struct x100000 | 77.732 us/op | 77.491 us/op | 1.00 | | Container {a,vec,b} - as tree x100000 | 403.87 us/op | 402.62 us/op | 1.00 | | get 2 props x1000000 - rawObject | 309.95 us/op | 310.51 us/op | 1.00 | | get 2 props x1000000 - proxy | 71.793 ms/op | 71.340 ms/op | 1.01 | | get 2 props x1000000 - customObj | 309.45 us/op | 310.57 us/op | 1.00 | | Simple object binary -> struct | 624.00 ns/op | 677.00 ns/op | 0.92 | | Simple object binary -> tree_backed | 1.7560 us/op | 1.8790 us/op | 0.93 | | Simple object struct -> tree_backed | 2.2190 us/op | 2.3550 us/op | 0.94 | | Simple object tree_backed -> struct | 1.8320 us/op | 2.0850 us/op | 0.88 | | Simple object struct -> binary | 941.00 ns/op | 1.0400 us/op | 0.90 | | Simple object tree_backed -> binary | 1.5990 us/op | 1.7320 us/op | 0.92 | | aggregationBits binary -> struct | 568.00 ns/op | 612.00 ns/op | 0.93 | | aggregationBits binary -> tree_backed | 2.1300 us/op | 2.3470 us/op | 0.91 | | aggregationBits struct -> tree_backed | 2.5560 us/op | 3.0840 us/op | 0.83 | | aggregationBits tree_backed -> struct | 1.0800 us/op | 1.3370 us/op | 0.81 | | aggregationBits struct -> binary | 796.00 ns/op | 943.00 ns/op | 0.84 | | aggregationBits tree_backed -> binary | 1.0070 us/op | 1.1710 us/op | 0.86 | | List(uint8) 100000 binary -> struct | 1.3452 ms/op | 1.5123 ms/op | 0.89 | | List(uint8) 100000 binary -> tree_backed | 90.108 us/op | 120.82 us/op | 0.75 | | List(uint8) 100000 struct -> tree_backed | 1.3770 ms/op | 1.4987 ms/op | 0.92 | | List(uint8) 100000 tree_backed -> struct | 983.01 us/op | 967.99 us/op | 1.02 | | List(uint8) 100000 struct -> binary | 1.2848 ms/op | 1.3951 ms/op | 0.92 | | List(uint8) 100000 tree_backed -> binary | 81.324 us/op | 86.130 us/op | 0.94 | | List(uint64Number) 100000 binary -> struct | 1.2234 ms/op | 1.3366 ms/op | 0.92 | | List(uint64Number) 100000 binary -> tree_backed | 3.1149 ms/op | 3.2667 ms/op | 0.95 | | List(uint64Number) 100000 struct -> tree_backed | 4.7955 ms/op | 4.4198 ms/op | 1.08 | | List(uint64Number) 100000 tree_backed -> struct | 2.1593 ms/op | 2.4672 ms/op | 0.88 | | List(uint64Number) 100000 struct -> binary | 1.4925 ms/op | 1.6557 ms/op | 0.90 | | List(uint64Number) 100000 tree_backed -> binary | 752.43 us/op | 857.90 us/op | 0.88 | | List(Uint64Bigint) 100000 binary -> struct | 3.3288 ms/op | 3.6727 ms/op | 0.91 | | List(Uint64Bigint) 100000 binary -> tree_backed | 2.8196 ms/op | 3.1711 ms/op | 0.89 | | List(Uint64Bigint) 100000 struct -> tree_backed | 5.3331 ms/op | 5.3821 ms/op | 0.99 | | List(Uint64Bigint) 100000 tree_backed -> struct | 4.4591 ms/op | 4.4546 ms/op | 1.00 | | List(Uint64Bigint) 100000 struct -> binary | 2.0725 ms/op | 2.0691 ms/op | 1.00 | | List(Uint64Bigint) 100000 tree_backed -> binary | 865.39 us/op | 851.98 us/op | 1.02 | | Vector(Root) 100000 binary -> struct | 29.643 ms/op | 30.048 ms/op | 0.99 | | Vector(Root) 100000 binary -> tree_backed | 25.064 ms/op | 24.979 ms/op | 1.00 | | Vector(Root) 100000 struct -> tree_backed | 34.959 ms/op | 33.116 ms/op | 1.06 | | Vector(Root) 100000 tree_backed -> struct | 43.344 ms/op | 39.824 ms/op | 1.09 | | Vector(Root) 100000 struct -> binary | 1.9137 ms/op | 1.8913 ms/op | 1.01 | | Vector(Root) 100000 tree_backed -> binary | 8.8761 ms/op | 9.3856 ms/op | 0.95 | | List(Validator) 100000 binary -> struct | 109.17 ms/op | 104.74 ms/op | 1.04 | | List(Validator) 100000 binary -> tree_backed | 282.48 ms/op | 272.71 ms/op | 1.04 | | List(Validator) 100000 struct -> tree_backed | 296.12 ms/op | 282.33 ms/op | 1.05 | | List(Validator) 100000 tree_backed -> struct | 201.09 ms/op | 185.88 ms/op | 1.08 | | List(Validator) 100000 struct -> binary | 31.472 ms/op | 30.363 ms/op | 1.04 | | List(Validator) 100000 tree_backed -> binary | 103.23 ms/op | 96.615 ms/op | 1.07 | | List(Validator-NS) 100000 binary -> struct | 95.265 ms/op | 95.863 ms/op | 0.99 | | List(Validator-NS) 100000 binary -> tree_backed | 150.42 ms/op | 151.81 ms/op | 0.99 | | List(Validator-NS) 100000 struct -> tree_backed | 185.69 ms/op | 185.82 ms/op | 1.00 | | List(Validator-NS) 100000 tree_backed -> struct | 151.34 ms/op | 151.36 ms/op | 1.00 | | List(Validator-NS) 100000 struct -> binary | 31.338 ms/op | 30.539 ms/op | 1.03 | | List(Validator-NS) 100000 tree_backed -> binary | 36.054 ms/op | 36.278 ms/op | 0.99 | | get epochStatuses - MutableVector | 89.285 us/op | 94.288 us/op | 0.95 | | get epochStatuses - ViewDU | 204.79 us/op | 195.34 us/op | 1.05 | | set epochStatuses - ListTreeView | 1.4425 ms/op | 1.4369 ms/op | 1.00 | | set epochStatuses - ListTreeView - set() | 433.33 us/op | 447.12 us/op | 0.97 | | set epochStatuses - ListTreeView - commit() | 415.18 us/op | 410.78 us/op | 1.01 | | bitstring | 643.95 ns/op | 642.17 ns/op | 1.00 | | bit mask | 14.171 ns/op | 13.940 ns/op | 1.02 | | struct - increase slot to 1000000 | 928.79 us/op | 927.58 us/op | 1.00 | | UintNumberType - increase slot to 1000000 | 28.479 ms/op | 28.505 ms/op | 1.00 | | UintBigintType - increase slot to 1000000 | 416.45 ms/op | 404.10 ms/op | 1.03 | | UintBigint8 x 100000 tree_deserialize | 4.5501 ms/op | 3.7593 ms/op | 1.21 | | UintBigint8 x 100000 tree_serialize | 1.1856 ms/op | 1.1866 ms/op | 1.00 | | UintBigint16 x 100000 tree_deserialize | 4.6559 ms/op | 3.5223 ms/op | 1.32 | | UintBigint16 x 100000 tree_serialize | 1.1392 ms/op | 1.1479 ms/op | 0.99 | | UintBigint32 x 100000 tree_deserialize | 4.6758 ms/op | 5.2458 ms/op | 0.89 | | UintBigint32 x 100000 tree_serialize | 1.2139 ms/op | 1.2169 ms/op | 1.00 | | UintBigint64 x 100000 tree_deserialize | 5.3488 ms/op | 5.5721 ms/op | 0.96 | | UintBigint64 x 100000 tree_serialize | 1.6110 ms/op | 1.5799 ms/op | 1.02 | | UintBigint8 x 100000 value_deserialize | 436.45 us/op | 433.35 us/op | 1.01 | | UintBigint8 x 100000 value_serialize | 583.54 us/op | 595.01 us/op | 0.98 | | UintBigint16 x 100000 value_deserialize | 468.75 us/op | 464.74 us/op | 1.01 | | UintBigint16 x 100000 value_serialize | 613.42 us/op | 630.99 us/op | 0.97 | | UintBigint32 x 100000 value_deserialize | 433.58 us/op | 433.71 us/op | 1.00 | | UintBigint32 x 100000 value_serialize | 626.22 us/op | 626.07 us/op | 1.00 | | UintBigint64 x 100000 value_deserialize | 465.04 us/op | 470.35 us/op | 0.99 | | UintBigint64 x 100000 value_serialize | 800.24 us/op | 805.80 us/op | 0.99 | | UintBigint8 x 100000 deserialize | 4.6421 ms/op | 4.7229 ms/op | 0.98 | | UintBigint8 x 100000 serialize | 1.4260 ms/op | 1.4524 ms/op | 0.98 | | UintBigint16 x 100000 deserialize | 4.6640 ms/op | 4.6000 ms/op | 1.01 | | UintBigint16 x 100000 serialize | 1.4662 ms/op | 1.4943 ms/op | 0.98 | | UintBigint32 x 100000 deserialize | 5.5946 ms/op | 5.6218 ms/op | 1.00 | | UintBigint32 x 100000 serialize | 2.8710 ms/op | 2.8077 ms/op | 1.02 | | UintBigint64 x 100000 deserialize | 3.7254 ms/op | 3.6731 ms/op | 1.01 | | UintBigint64 x 100000 serialize | 1.5014 ms/op | 1.4961 ms/op | 1.00 | | UintBigint128 x 100000 deserialize | 5.8418 ms/op | 5.9133 ms/op | 0.99 | | UintBigint128 x 100000 serialize | 16.914 ms/op | 16.867 ms/op | 1.00 | | UintBigint256 x 100000 deserialize | 11.158 ms/op | 11.045 ms/op | 1.01 | | UintBigint256 x 100000 serialize | 49.406 ms/op | 49.953 ms/op | 0.99 | | Slice from Uint8Array x25000 | 972.68 us/op | 1.0132 ms/op | 0.96 | | Slice from ArrayBuffer x25000 | 17.598 ms/op | 17.379 ms/op | 1.01 | | Slice from ArrayBuffer x25000 + new Uint8Array | 19.115 ms/op | 19.184 ms/op | 1.00 | | Copy Uint8Array 100000 iterate | 806.93 us/op | 818.94 us/op | 0.99 | | Copy Uint8Array 100000 slice | 90.358 us/op | 89.874 us/op | 1.01 | | Copy Uint8Array 100000 Uint8Array.prototype.slice.call | 90.552 us/op | 89.785 us/op | 1.01 | | Copy Buffer 100000 Uint8Array.prototype.slice.call | 90.736 us/op | 89.811 us/op | 1.01 | | Copy Uint8Array 100000 slice + set | 150.28 us/op | 154.17 us/op | 0.97 | | Copy Uint8Array 100000 subarray + set | 90.650 us/op | 89.165 us/op | 1.02 | | Copy Uint8Array 100000 slice arrayBuffer | 91.205 us/op | 89.492 us/op | 1.02 | | Uint64 deserialize 100000 - iterate Uint8Array | 1.7355 ms/op | 1.7551 ms/op | 0.99 | | Uint64 deserialize 100000 - by Uint32A | 1.7371 ms/op | 1.7508 ms/op | 0.99 | | Uint64 deserialize 100000 - by DataView.getUint32 x2 | 1.7268 ms/op | 1.7232 ms/op | 1.00 | | Uint64 deserialize 100000 - by DataView.getBigUint64 | 4.8955 ms/op | 4.8253 ms/op | 1.01 | | Uint64 deserialize 100000 - by byte | 65.094 ms/op | 65.306 ms/op | 1.00 |

by benchmarkbot/action

twoeths commented 4 months ago

Implementation note for lodestar: migrate state.balances to export const Balances = new ListUintNum64Type(VALIDATOR_REGISTRY_LIMIT);