ChainSafe / ssz

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

feat: add StableContainer #373

Open wemeetagain opened 4 months ago

wemeetagain commented 4 months ago

Motivation

Description

github-actions[bot] commented 4 months ago

Performance Report

✔️ no performance regression detected

Full benchmark results | Benchmark suite | Current: 824caea20949ab25e6ccbf199faa7d15be2e5e1d | Previous: 1dc50ef2985a03c315bbce44165cd271a4a6e2df | Ratio | |-|-|-|-| | digestTwoHashObjects 50023 times | 47.914 ms/op | 48.133 ms/op | 1.00 | | digest64 50023 times | 53.499 ms/op | 53.792 ms/op | 0.99 | | digest 50023 times | 55.320 ms/op | 57.269 ms/op | 0.97 | | input length 32 | 1.2480 us/op | 1.2580 us/op | 0.99 | | input length 64 | 1.3510 us/op | 1.3750 us/op | 0.98 | | input length 128 | 2.3180 us/op | 2.3320 us/op | 0.99 | | input length 256 | 3.4530 us/op | 3.6010 us/op | 0.96 | | input length 512 | 5.6320 us/op | 5.8540 us/op | 0.96 | | input length 1024 | 10.822 us/op | 11.249 us/op | 0.96 | | digest 1000000 times | 878.78 ms/op | 928.44 ms/op | 0.95 | | hashObjectToByteArray 50023 times | 1.4360 ms/op | 1.4270 ms/op | 1.01 | | byteArrayToHashObject 50023 times | 2.5567 ms/op | 2.5396 ms/op | 1.01 | | digest64 200092 times | 219.66 ms/op | 233.71 ms/op | 0.94 | | hash 200092 times using batchHash4UintArray64s | 242.53 ms/op | 262.76 ms/op | 0.92 | | digest64HashObjects 200092 times | 193.68 ms/op | 197.43 ms/op | 0.98 | | hash 200092 times using batchHash4HashObjectInputs | 205.60 ms/op | 206.47 ms/op | 1.00 | | getGindicesAtDepth | 4.4060 us/op | 4.3090 us/op | 1.02 | | iterateAtDepth | 7.7480 us/op | 7.6000 us/op | 1.02 | | getGindexBits | 480.00 ns/op | 473.00 ns/op | 1.01 | | gindexIterator | 1.0930 us/op | 1.0450 us/op | 1.05 | | HashComputationLevel.push then loop | 25.560 ms/op | 28.201 ms/op | 0.91 | | HashComputation[] push then loop | 47.119 ms/op | 49.163 ms/op | 0.96 | | hash 2 Uint8Array 500000 times - as-sha256 | 543.01 ms/op | 548.74 ms/op | 0.99 | | hashTwoObjects 500000 times - as-sha256 | 504.07 ms/op | 500.19 ms/op | 1.01 | | executeHashComputations - as-sha256 | 48.379 ms/op | 48.276 ms/op | 1.00 | | hash 2 Uint8Array 500000 times - noble | 1.0679 s/op | 1.1227 s/op | 0.95 | | hashTwoObjects 500000 times - noble | 1.4912 s/op | 1.6548 s/op | 0.90 | | executeHashComputations - noble | 40.813 ms/op | 42.226 ms/op | 0.97 | | hash 2 Uint8Array 500000 times - hashtree | 225.56 ms/op | 232.33 ms/op | 0.97 | | hashTwoObjects 500000 times - hashtree | 213.98 ms/op | 210.23 ms/op | 1.02 | | executeHashComputations - hashtree | 11.881 ms/op | 11.083 ms/op | 1.07 | | getHashComputations | 3.2223 ms/op | 2.9669 ms/op | 1.09 | | executeHashComputations | 11.542 ms/op | 12.854 ms/op | 0.90 | | get root | 17.263 ms/op | 17.981 ms/op | 0.96 | | getNodeH() x7812.5 avg hindex | 13.704 us/op | 11.952 us/op | 1.15 | | getNodeH() x7812.5 index 0 | 6.2910 us/op | 6.2460 us/op | 1.01 | | getNodeH() x7812.5 index 7 | 6.2640 us/op | 6.3690 us/op | 0.98 | | getNodeH() x7812.5 index 7 with key array | 6.2590 us/op | 6.2960 us/op | 0.99 | | new LeafNode() x7812.5 | 14.954 us/op | 14.752 us/op | 1.01 | | getHashComputations 250000 nodes | 22.254 ms/op | 21.030 ms/op | 1.06 | | batchHash 250000 nodes | 87.160 ms/op | 94.098 ms/op | 0.93 | | get root 250000 nodes | 119.38 ms/op | 119.27 ms/op | 1.00 | | getHashComputations 500000 nodes | 27.238 ms/op | 32.594 ms/op | 0.84 | | batchHash 500000 nodes | 167.75 ms/op | 172.95 ms/op | 0.97 | | get root 500000 nodes | 236.47 ms/op | 249.47 ms/op | 0.95 | | getHashComputations 1000000 nodes | 68.767 ms/op | 77.094 ms/op | 0.89 | | batchHash 1000000 nodes | 336.17 ms/op | 367.39 ms/op | 0.92 | | get root 1000000 nodes | 482.22 ms/op | 489.52 ms/op | 0.99 | | multiproof - depth 15, 1 requested leaves | 8.4460 us/op | 8.5110 us/op | 0.99 | | tree offset multiproof - depth 15, 1 requested leaves | 18.235 us/op | 18.203 us/op | 1.00 | | compact multiproof - depth 15, 1 requested leaves | 3.5670 us/op | 3.5740 us/op | 1.00 | | multiproof - depth 15, 2 requested leaves | 12.451 us/op | 12.007 us/op | 1.04 | | tree offset multiproof - depth 15, 2 requested leaves | 22.007 us/op | 22.849 us/op | 0.96 | | compact multiproof - depth 15, 2 requested leaves | 3.6010 us/op | 3.7190 us/op | 0.97 | | multiproof - depth 15, 3 requested leaves | 16.833 us/op | 16.744 us/op | 1.01 | | tree offset multiproof - depth 15, 3 requested leaves | 27.842 us/op | 29.753 us/op | 0.94 | | compact multiproof - depth 15, 3 requested leaves | 4.2300 us/op | 4.3070 us/op | 0.98 | | multiproof - depth 15, 4 requested leaves | 22.075 us/op | 23.344 us/op | 0.95 | | tree offset multiproof - depth 15, 4 requested leaves | 34.466 us/op | 36.846 us/op | 0.94 | | compact multiproof - depth 15, 4 requested leaves | 5.0190 us/op | 5.8380 us/op | 0.86 | | packedRootsBytesToLeafNodes bytes 4000 offset 0 | 2.0170 us/op | 2.0270 us/op | 1.00 | | packedRootsBytesToLeafNodes bytes 4000 offset 1 | 1.9920 us/op | 1.9980 us/op | 1.00 | | packedRootsBytesToLeafNodes bytes 4000 offset 2 | 1.9960 us/op | 2.0120 us/op | 0.99 | | packedRootsBytesToLeafNodes bytes 4000 offset 3 | 1.9740 us/op | 2.0840 us/op | 0.95 | | subtreeFillToContents depth 40 count 250000 | 45.033 ms/op | 48.258 ms/op | 0.93 | | setRoot - gindexBitstring | 10.927 ms/op | 10.272 ms/op | 1.06 | | setRoot - gindex | 11.634 ms/op | 11.098 ms/op | 1.05 | | getRoot - gindexBitstring | 2.5702 ms/op | 2.6634 ms/op | 0.96 | | getRoot - gindex | 3.4475 ms/op | 3.5613 ms/op | 0.97 | | getHashObject then setHashObject | 12.071 ms/op | 11.668 ms/op | 1.03 | | setNodeWithFn | 9.5944 ms/op | 9.6807 ms/op | 0.99 | | getNodeAtDepth depth 0 x100000 | 1.1254 ms/op | 1.1138 ms/op | 1.01 | | setNodeAtDepth depth 0 x100000 | 2.8634 ms/op | 2.8359 ms/op | 1.01 | | getNodesAtDepth depth 0 x100000 | 1.0580 ms/op | 1.0533 ms/op | 1.00 | | setNodesAtDepth depth 0 x100000 | 1.5242 ms/op | 1.5176 ms/op | 1.00 | | getNodeAtDepth depth 1 x100000 | 1.1934 ms/op | 1.1837 ms/op | 1.01 | | setNodeAtDepth depth 1 x100000 | 6.1754 ms/op | 6.0382 ms/op | 1.02 | | getNodesAtDepth depth 1 x100000 | 1.1841 ms/op | 1.1800 ms/op | 1.00 | | setNodesAtDepth depth 1 x100000 | 4.9528 ms/op | 6.2059 ms/op | 0.80 | | getNodeAtDepth depth 2 x100000 | 1.4669 ms/op | 1.4547 ms/op | 1.01 | | setNodeAtDepth depth 2 x100000 | 10.455 ms/op | 10.217 ms/op | 1.02 | | getNodesAtDepth depth 2 x100000 | 18.951 ms/op | 21.592 ms/op | 0.88 | | setNodesAtDepth depth 2 x100000 | 14.857 ms/op | 16.512 ms/op | 0.90 | | tree.getNodesAtDepth - gindexes | 8.5768 ms/op | 8.8271 ms/op | 0.97 | | tree.getNodesAtDepth - push all nodes | 2.5860 ms/op | 2.3076 ms/op | 1.12 | | tree.getNodesAtDepth - navigation | 235.36 us/op | 243.84 us/op | 0.97 | | tree.setNodesAtDepth - indexes | 425.53 us/op | 457.54 us/op | 0.93 | | set at depth 8 | 501.00 ns/op | 512.00 ns/op | 0.98 | | set at depth 16 | 679.00 ns/op | 695.00 ns/op | 0.98 | | set at depth 32 | 1.1000 us/op | 1.1500 us/op | 0.96 | | iterateNodesAtDepth 8 256 | 13.790 us/op | 14.931 us/op | 0.92 | | getNodesAtDepth 8 256 | 3.6020 us/op | 3.7970 us/op | 0.95 | | iterateNodesAtDepth 16 65536 | 4.4275 ms/op | 4.7069 ms/op | 0.94 | | getNodesAtDepth 16 65536 | 1.6500 ms/op | 1.9283 ms/op | 0.86 | | iterateNodesAtDepth 32 250000 | 15.277 ms/op | 16.770 ms/op | 0.91 | | getNodesAtDepth 32 250000 | 4.3834 ms/op | 4.6775 ms/op | 0.94 | | iterateNodesAtDepth 40 250000 | 15.350 ms/op | 17.133 ms/op | 0.90 | | getNodesAtDepth 40 250000 | 4.3586 ms/op | 8.1189 ms/op | 0.54 | | 250000 validators root getter | 118.47 ms/op | 121.88 ms/op | 0.97 | | 250000 validators batchHash() | 85.215 ms/op | 109.73 ms/op | 0.78 | | 250000 validators hashComputations | 18.435 ms/op | 17.362 ms/op | 1.06 | | bitlist bytes to struct (120,90) | 909.00 ns/op | 998.00 ns/op | 0.91 | | bitlist bytes to tree (120,90) | 3.4890 us/op | 3.8180 us/op | 0.91 | | bitlist bytes to struct (2048,2048) | 1.2700 us/op | 1.4070 us/op | 0.90 | | bitlist bytes to tree (2048,2048) | 4.2640 us/op | 4.4550 us/op | 0.96 | | ByteListType - deserialize | 7.8446 ms/op | 9.1992 ms/op | 0.85 | | BasicListType - deserialize | 17.045 ms/op | 18.276 ms/op | 0.93 | | ByteListType - serialize | 8.2616 ms/op | 8.0877 ms/op | 1.02 | | BasicListType - serialize | 10.904 ms/op | 11.164 ms/op | 0.98 | | BasicListType - tree_convertToStruct | 28.526 ms/op | 30.343 ms/op | 0.94 | | List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate | 4.7696 ms/op | 4.8622 ms/op | 0.98 | | List[uint8, 68719476736] len 300000 ViewDU.get(i) | 3.9939 ms/op | 3.9857 ms/op | 1.00 | | Array.push len 300000 empty Array - number | 6.2797 ms/op | 7.6708 ms/op | 0.82 | | Array.set len 300000 from new Array - number | 2.2182 ms/op | 1.8425 ms/op | 1.20 | | Array.set len 300000 - number | 6.1627 ms/op | 6.4571 ms/op | 0.95 | | Uint8Array.set len 300000 | 394.20 us/op | 393.08 us/op | 1.00 | | Uint32Array.set len 300000 | 505.83 us/op | 488.37 us/op | 1.04 | | Container({a: uint8, b: uint8}) getViewDU x300000 | 49.478 ms/op | 50.716 ms/op | 0.98 | | ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 | 11.128 ms/op | 11.636 ms/op | 0.96 | | List(Container) len 300000 ViewDU.getAllReadonly() + iterate | 213.09 ms/op | 239.62 ms/op | 0.89 | | List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate | 246.83 ms/op | 321.41 ms/op | 0.77 | | List(Container) len 300000 ViewDU.get(i) | 6.4778 ms/op | 6.9628 ms/op | 0.93 | | List(Container) len 300000 ViewDU.getReadonly(i) | 6.3501 ms/op | 6.8634 ms/op | 0.93 | | List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate | 39.133 ms/op | 37.302 ms/op | 1.05 | | List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate | 4.7662 ms/op | 8.2226 ms/op | 0.58 | | List(ContainerNodeStruct) len 300000 ViewDU.get(i) | 6.1578 ms/op | 6.5813 ms/op | 0.94 | | List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) | 5.9751 ms/op | 6.4747 ms/op | 0.92 | | Array.push len 300000 empty Array - object | 6.4915 ms/op | 7.6359 ms/op | 0.85 | | Array.set len 300000 from new Array - object | 2.4041 ms/op | 2.5378 ms/op | 0.95 | | Array.set len 300000 - object | 6.2961 ms/op | 8.3293 ms/op | 0.76 | | cachePermanentRootStruct no cache | 5.3200 us/op | 5.8100 us/op | 0.92 | | cachePermanentRootStruct with cache | 210.00 ns/op | 261.00 ns/op | 0.80 | | epochParticipation len 250000 rws 7813 | 2.2098 ms/op | 2.3850 ms/op | 0.93 | | BeaconState ViewDU hashTreeRoot() vc=200000 | 104.34 ms/op | 104.21 ms/op | 1.00 | | BeaconState ViewDU recursive hash - commit step vc=200000 | 5.0949 ms/op | 5.1522 ms/op | 0.99 | | BeaconState ViewDU validator tree creation vc=10000 | 35.754 ms/op | 37.073 ms/op | 0.96 | | BeaconState ViewDU batchHashTreeRoot vc=200000 | 94.708 ms/op | 96.108 ms/op | 0.99 | | BeaconState ViewDU hashTreeRoot - commit step vc=200000 | 82.386 ms/op | 82.669 ms/op | 1.00 | | BeaconState ViewDU hashTreeRoot - hash step vc=200000 | 15.512 ms/op | 16.121 ms/op | 0.96 | | deserialize Attestation - tree | 4.2890 us/op | 4.6290 us/op | 0.93 | | deserialize Attestation - struct | 1.8270 us/op | 1.9490 us/op | 0.94 | | deserialize SignedAggregateAndProof - tree | 3.8810 us/op | 3.9820 us/op | 0.97 | | deserialize SignedAggregateAndProof - struct | 2.9810 us/op | 3.1310 us/op | 0.95 | | deserialize SyncCommitteeMessage - tree | 1.0860 us/op | 1.0940 us/op | 0.99 | | deserialize SyncCommitteeMessage - struct | 1.1100 us/op | 1.0870 us/op | 1.02 | | deserialize SignedContributionAndProof - tree | 2.1150 us/op | 2.1800 us/op | 0.97 | | deserialize SignedContributionAndProof - struct | 2.2130 us/op | 2.3870 us/op | 0.93 | | deserialize SignedBeaconBlock - tree | 220.58 us/op | 220.70 us/op | 1.00 | | deserialize SignedBeaconBlock - struct | 118.81 us/op | 126.03 us/op | 0.94 | | BeaconState vc 300000 - deserialize tree | 621.81 ms/op | 640.71 ms/op | 0.97 | | BeaconState vc 300000 - serialize tree | 129.58 ms/op | 143.01 ms/op | 0.91 | | BeaconState.historicalRoots vc 300000 - deserialize tree | 725.00 ns/op | 820.00 ns/op | 0.88 | | BeaconState.historicalRoots vc 300000 - serialize tree | 650.00 ns/op | 696.00 ns/op | 0.93 | | BeaconState.validators vc 300000 - deserialize tree | 602.37 ms/op | 633.49 ms/op | 0.95 | | BeaconState.validators vc 300000 - serialize tree | 98.440 ms/op | 96.018 ms/op | 1.03 | | BeaconState.balances vc 300000 - deserialize tree | 24.927 ms/op | 22.892 ms/op | 1.09 | | BeaconState.balances vc 300000 - serialize tree | 4.0210 ms/op | 3.7395 ms/op | 1.08 | | BeaconState.previousEpochParticipation vc 300000 - deserialize tree | 456.25 us/op | 454.19 us/op | 1.00 | | BeaconState.previousEpochParticipation vc 300000 - serialize tree | 292.14 us/op | 280.32 us/op | 1.04 | | BeaconState.currentEpochParticipation vc 300000 - deserialize tree | 447.63 us/op | 391.68 us/op | 1.14 | | BeaconState.currentEpochParticipation vc 300000 - serialize tree | 288.70 us/op | 273.28 us/op | 1.06 | | BeaconState.inactivityScores vc 300000 - deserialize tree | 25.111 ms/op | 25.757 ms/op | 0.97 | | BeaconState.inactivityScores vc 300000 - serialize tree | 3.4650 ms/op | 3.8948 ms/op | 0.89 | | hashTreeRoot Attestation - struct | 16.138 us/op | 21.234 us/op | 0.76 | | hashTreeRoot Attestation - tree | 9.1340 us/op | 9.0710 us/op | 1.01 | | hashTreeRoot SignedAggregateAndProof - struct | 24.250 us/op | 25.597 us/op | 0.95 | | hashTreeRoot SignedAggregateAndProof - tree | 12.927 us/op | 12.800 us/op | 1.01 | | hashTreeRoot SyncCommitteeMessage - struct | 6.1480 us/op | 6.6670 us/op | 0.92 | | hashTreeRoot SyncCommitteeMessage - tree | 3.1630 us/op | 3.1200 us/op | 1.01 | | hashTreeRoot SignedContributionAndProof - struct | 14.691 us/op | 15.231 us/op | 0.96 | | hashTreeRoot SignedContributionAndProof - tree | 8.8360 us/op | 8.7460 us/op | 1.01 | | hashTreeRoot SignedBeaconBlock - struct | 1.2854 ms/op | 1.5448 ms/op | 0.83 | | hashTreeRoot SignedBeaconBlock - tree | 769.37 us/op | 774.26 us/op | 0.99 | | hashTreeRoot Validator - struct | 7.6860 us/op | 8.6410 us/op | 0.89 | | hashTreeRoot Validator - tree | 6.4280 us/op | 7.2210 us/op | 0.89 | | BeaconState vc 300000 - hashTreeRoot tree | 2.1178 s/op | 2.1489 s/op | 0.99 | | BeaconState vc 300000 - batchHashTreeRoot tree | 3.5129 s/op | 3.7418 s/op | 0.94 | | BeaconState.historicalRoots vc 300000 - hashTreeRoot tree | 1.0040 us/op | 1.0590 us/op | 0.95 | | BeaconState.validators vc 300000 - hashTreeRoot tree | 2.1312 s/op | 2.2721 s/op | 0.94 | | BeaconState.balances vc 300000 - hashTreeRoot tree | 32.990 ms/op | 35.865 ms/op | 0.92 | | BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree | 4.1103 ms/op | 3.9650 ms/op | 1.04 | | BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree | 4.0991 ms/op | 3.9582 ms/op | 1.04 | | BeaconState.inactivityScores vc 300000 - hashTreeRoot tree | 37.136 ms/op | 36.002 ms/op | 1.03 | | hash64 x18 | 10.049 us/op | 9.4170 us/op | 1.07 | | hashTwoObjects x18 | 8.8660 us/op | 8.5700 us/op | 1.03 | | hash64 x1740 | 840.67 us/op | 941.11 us/op | 0.89 | | hashTwoObjects x1740 | 822.80 us/op | 801.55 us/op | 1.03 | | hash64 x2700000 | 1.3028 s/op | 1.3917 s/op | 0.94 | | hashTwoObjects x2700000 | 1.2692 s/op | 1.2413 s/op | 1.02 | | get_exitEpoch - ContainerType | 363.00 ns/op | 277.00 ns/op | 1.31 | | get_exitEpoch - ContainerNodeStructType | 368.00 ns/op | 263.00 ns/op | 1.40 | | set_exitEpoch - ContainerType | 376.00 ns/op | 262.00 ns/op | 1.44 | | set_exitEpoch - ContainerNodeStructType | 374.00 ns/op | 280.00 ns/op | 1.34 | | get_pubkey - ContainerType | 886.00 ns/op | 919.00 ns/op | 0.96 | | get_pubkey - ContainerNodeStructType | 362.00 ns/op | 300.00 ns/op | 1.21 | | hashTreeRoot - ContainerType | 642.00 ns/op | 468.00 ns/op | 1.37 | | hashTreeRoot - ContainerNodeStructType | 674.00 ns/op | 491.00 ns/op | 1.37 | | createProof - ContainerType | 6.6260 us/op | 4.2960 us/op | 1.54 | | createProof - ContainerNodeStructType | 25.778 us/op | 22.385 us/op | 1.15 | | serialize - ContainerType | 1.9460 us/op | 2.0100 us/op | 0.97 | | serialize - ContainerNodeStructType | 1.4910 us/op | 1.6020 us/op | 0.93 | | set_exitEpoch_and_hashTreeRoot - ContainerType | 2.6600 us/op | 2.8950 us/op | 0.92 | | set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType | 7.2530 us/op | 7.7510 us/op | 0.94 | | Array - for of | 13.286 us/op | 9.7260 us/op | 1.37 | | Array - for(;;) | 13.418 us/op | 10.013 us/op | 1.34 | | basicListValue.readonlyValuesArray() | 4.4982 ms/op | 4.6683 ms/op | 0.96 | | basicListValue.readonlyValuesArray() + loop all | 4.4988 ms/op | 5.3708 ms/op | 0.84 | | compositeListValue.readonlyValuesArray() | 25.985 ms/op | 32.117 ms/op | 0.81 | | compositeListValue.readonlyValuesArray() + loop all | 30.733 ms/op | 29.924 ms/op | 1.03 | | Number64UintType - get balances list | 4.1380 ms/op | 4.8945 ms/op | 0.85 | | Number64UintType - set balances list | 10.202 ms/op | 10.200 ms/op | 1.00 | | Number64UintType - get and increase 10 then set | 43.482 ms/op | 43.590 ms/op | 1.00 | | Number64UintType - increase 10 using applyDelta | 16.004 ms/op | 16.929 ms/op | 0.95 | | Number64UintType - increase 10 using applyDeltaInBatch | 15.908 ms/op | 16.861 ms/op | 0.94 | | tree_newTreeFromUint64Deltas | 17.209 ms/op | 17.580 ms/op | 0.98 | | unsafeUint8ArrayToTree | 32.361 ms/op | 33.866 ms/op | 0.96 | | bitLength(50) | 229.00 ns/op | 245.00 ns/op | 0.93 | | bitLengthStr(50) | 219.00 ns/op | 248.00 ns/op | 0.88 | | bitLength(8000) | 223.00 ns/op | 260.00 ns/op | 0.86 | | bitLengthStr(8000) | 260.00 ns/op | 277.00 ns/op | 0.94 | | bitLength(250000) | 227.00 ns/op | 255.00 ns/op | 0.89 | | bitLengthStr(250000) | 300.00 ns/op | 313.00 ns/op | 0.96 | | floor - Math.floor (53) | 1.2461 ns/op | 1.2383 ns/op | 1.01 | | floor - << 0 (53) | 1.2436 ns/op | 1.2375 ns/op | 1.00 | | floor - Math.floor (512) | 1.2436 ns/op | 1.2543 ns/op | 0.99 | | floor - << 0 (512) | 1.2431 ns/op | 1.2384 ns/op | 1.00 | | fnIf(0) | 1.5532 ns/op | 1.5484 ns/op | 1.00 | | fnSwitch(0) | 2.1769 ns/op | 2.1658 ns/op | 1.01 | | fnObj(0) | 1.5622 ns/op | 1.5493 ns/op | 1.01 | | fnArr(0) | 1.5631 ns/op | 1.5529 ns/op | 1.01 | | fnIf(4) | 2.1756 ns/op | 2.1653 ns/op | 1.00 | | fnSwitch(4) | 2.1783 ns/op | 2.1991 ns/op | 0.99 | | fnObj(4) | 1.5736 ns/op | 1.5483 ns/op | 1.02 | | fnArr(4) | 1.5557 ns/op | 1.5706 ns/op | 0.99 | | fnIf(9) | 3.1141 ns/op | 3.0906 ns/op | 1.01 | | fnSwitch(9) | 2.1766 ns/op | 2.1987 ns/op | 0.99 | | fnObj(9) | 1.5547 ns/op | 1.5592 ns/op | 1.00 | | fnArr(9) | 1.5543 ns/op | 1.5456 ns/op | 1.01 | | Container {a,b,vec} - as struct x100000 | 124.44 us/op | 123.89 us/op | 1.00 | | Container {a,b,vec} - as tree x100000 | 342.95 us/op | 341.07 us/op | 1.01 | | Container {a,vec,b} - as struct x100000 | 155.61 us/op | 154.78 us/op | 1.01 | | Container {a,vec,b} - as tree x100000 | 373.71 us/op | 402.43 us/op | 0.93 | | get 2 props x1000000 - rawObject | 311.16 us/op | 309.28 us/op | 1.01 | | get 2 props x1000000 - proxy | 74.222 ms/op | 72.986 ms/op | 1.02 | | get 2 props x1000000 - customObj | 318.91 us/op | 311.03 us/op | 1.03 | | Simple object binary -> struct | 900.00 ns/op | 596.00 ns/op | 1.51 | | Simple object binary -> tree_backed | 1.9150 us/op | 1.0660 us/op | 1.80 | | Simple object struct -> tree_backed | 2.6080 us/op | 1.6350 us/op | 1.60 | | Simple object tree_backed -> struct | 2.4520 us/op | 1.6250 us/op | 1.51 | | Simple object struct -> binary | 1.0320 us/op | 829.00 ns/op | 1.24 | | Simple object tree_backed -> binary | 1.6580 us/op | 1.4530 us/op | 1.14 | | aggregationBits binary -> struct | 654.00 ns/op | 511.00 ns/op | 1.28 | | aggregationBits binary -> tree_backed | 2.5400 us/op | 2.0860 us/op | 1.22 | | aggregationBits struct -> tree_backed | 2.9820 us/op | 2.4640 us/op | 1.21 | | aggregationBits tree_backed -> struct | 1.2900 us/op | 1.0230 us/op | 1.26 | | aggregationBits struct -> binary | 819.00 ns/op | 792.00 ns/op | 1.03 | | aggregationBits tree_backed -> binary | 1.1220 us/op | 977.00 ns/op | 1.15 | | List(uint8) 100000 binary -> struct | 1.5761 ms/op | 1.4808 ms/op | 1.06 | | List(uint8) 100000 binary -> tree_backed | 94.401 us/op | 96.612 us/op | 0.98 | | List(uint8) 100000 struct -> tree_backed | 1.1314 ms/op | 1.1618 ms/op | 0.97 | | List(uint8) 100000 tree_backed -> struct | 1.0563 ms/op | 1.0415 ms/op | 1.01 | | List(uint8) 100000 struct -> binary | 1.0291 ms/op | 1.0312 ms/op | 1.00 | | List(uint8) 100000 tree_backed -> binary | 91.245 us/op | 92.142 us/op | 0.99 | | List(uint64Number) 100000 binary -> struct | 1.2006 ms/op | 1.2798 ms/op | 0.94 | | List(uint64Number) 100000 binary -> tree_backed | 2.6339 ms/op | 3.8945 ms/op | 0.68 | | List(uint64Number) 100000 struct -> tree_backed | 4.3499 ms/op | 5.8436 ms/op | 0.74 | | List(uint64Number) 100000 tree_backed -> struct | 2.3515 ms/op | 2.3376 ms/op | 1.01 | | List(uint64Number) 100000 struct -> binary | 1.3582 ms/op | 1.6151 ms/op | 0.84 | | List(uint64Number) 100000 tree_backed -> binary | 930.75 us/op | 901.30 us/op | 1.03 | | List(Uint64Bigint) 100000 binary -> struct | 4.0262 ms/op | 4.0316 ms/op | 1.00 | | List(Uint64Bigint) 100000 binary -> tree_backed | 3.5272 ms/op | 3.7637 ms/op | 0.94 | | List(Uint64Bigint) 100000 struct -> tree_backed | 5.1360 ms/op | 6.4457 ms/op | 0.80 | | List(Uint64Bigint) 100000 tree_backed -> struct | 4.5409 ms/op | 5.0072 ms/op | 0.91 | | List(Uint64Bigint) 100000 struct -> binary | 2.0467 ms/op | 2.0659 ms/op | 0.99 | | List(Uint64Bigint) 100000 tree_backed -> binary | 922.13 us/op | 1.0920 ms/op | 0.84 | | Vector(Root) 100000 binary -> struct | 34.493 ms/op | 35.527 ms/op | 0.97 | | Vector(Root) 100000 binary -> tree_backed | 35.900 ms/op | 33.557 ms/op | 1.07 | | Vector(Root) 100000 struct -> tree_backed | 44.093 ms/op | 44.978 ms/op | 0.98 | | Vector(Root) 100000 tree_backed -> struct | 51.352 ms/op | 50.142 ms/op | 1.02 | | Vector(Root) 100000 struct -> binary | 2.5634 ms/op | 2.7928 ms/op | 0.92 | | Vector(Root) 100000 tree_backed -> binary | 8.9101 ms/op | 10.251 ms/op | 0.87 | | List(Validator) 100000 binary -> struct | 98.747 ms/op | 100.76 ms/op | 0.98 | | List(Validator) 100000 binary -> tree_backed | 308.83 ms/op | 324.06 ms/op | 0.95 | | List(Validator) 100000 struct -> tree_backed | 320.92 ms/op | 339.28 ms/op | 0.95 | | List(Validator) 100000 tree_backed -> struct | 220.69 ms/op | 224.19 ms/op | 0.98 | | List(Validator) 100000 struct -> binary | 26.983 ms/op | 27.280 ms/op | 0.99 | | List(Validator) 100000 tree_backed -> binary | 118.69 ms/op | 118.06 ms/op | 1.01 | | List(Validator-NS) 100000 binary -> struct | 102.07 ms/op | 115.13 ms/op | 0.89 | | List(Validator-NS) 100000 binary -> tree_backed | 153.27 ms/op | 161.92 ms/op | 0.95 | | List(Validator-NS) 100000 struct -> tree_backed | 197.12 ms/op | 203.00 ms/op | 0.97 | | List(Validator-NS) 100000 tree_backed -> struct | 168.99 ms/op | 176.98 ms/op | 0.95 | | List(Validator-NS) 100000 struct -> binary | 27.282 ms/op | 27.957 ms/op | 0.98 | | List(Validator-NS) 100000 tree_backed -> binary | 31.615 ms/op | 34.879 ms/op | 0.91 | | get epochStatuses - MutableVector | 92.568 us/op | 116.49 us/op | 0.79 | | get epochStatuses - ViewDU | 199.94 us/op | 199.36 us/op | 1.00 | | set epochStatuses - ListTreeView | 1.7539 ms/op | 1.7212 ms/op | 1.02 | | set epochStatuses - ListTreeView - set() | 460.67 us/op | 426.97 us/op | 1.08 | | set epochStatuses - ListTreeView - commit() | 581.30 us/op | 1.6358 ms/op | 0.36 | | bitstring | 643.43 ns/op | 652.32 ns/op | 0.99 | | bit mask | 13.511 ns/op | 14.226 ns/op | 0.95 | | struct - increase slot to 1000000 | 934.71 us/op | 928.26 us/op | 1.01 | | UintNumberType - increase slot to 1000000 | 22.094 ms/op | 27.291 ms/op | 0.81 | | UintBigintType - increase slot to 1000000 | 173.48 ms/op | 196.10 ms/op | 0.88 | | UintBigint8 x 100000 tree_deserialize | 3.5845 ms/op | 5.1091 ms/op | 0.70 | | UintBigint8 x 100000 tree_serialize | 1.0960 ms/op | 1.1100 ms/op | 0.99 | | UintBigint16 x 100000 tree_deserialize | 4.7409 ms/op | 5.2915 ms/op | 0.90 | | UintBigint16 x 100000 tree_serialize | 1.2314 ms/op | 1.3759 ms/op | 0.90 | | UintBigint32 x 100000 tree_deserialize | 5.0191 ms/op | 5.4499 ms/op | 0.92 | | UintBigint32 x 100000 tree_serialize | 1.2421 ms/op | 1.3623 ms/op | 0.91 | | UintBigint64 x 100000 tree_deserialize | 5.1495 ms/op | 5.6278 ms/op | 0.92 | | UintBigint64 x 100000 tree_serialize | 1.6049 ms/op | 1.7370 ms/op | 0.92 | | UintBigint8 x 100000 value_deserialize | 435.20 us/op | 433.04 us/op | 1.01 | | UintBigint8 x 100000 value_serialize | 680.97 us/op | 808.02 us/op | 0.84 | | UintBigint16 x 100000 value_deserialize | 466.38 us/op | 464.58 us/op | 1.00 | | UintBigint16 x 100000 value_serialize | 740.45 us/op | 848.00 us/op | 0.87 | | UintBigint32 x 100000 value_deserialize | 435.34 us/op | 433.00 us/op | 1.01 | | UintBigint32 x 100000 value_serialize | 715.15 us/op | 845.72 us/op | 0.85 | | UintBigint64 x 100000 value_deserialize | 499.71 us/op | 496.47 us/op | 1.01 | | UintBigint64 x 100000 value_serialize | 892.40 us/op | 969.44 us/op | 0.92 | | UintBigint8 x 100000 deserialize | 3.2363 ms/op | 3.7772 ms/op | 0.86 | | UintBigint8 x 100000 serialize | 1.5576 ms/op | 1.7460 ms/op | 0.89 | | UintBigint16 x 100000 deserialize | 3.1562 ms/op | 3.7574 ms/op | 0.84 | | UintBigint16 x 100000 serialize | 1.5642 ms/op | 1.4925 ms/op | 1.05 | | UintBigint32 x 100000 deserialize | 3.4183 ms/op | 4.0283 ms/op | 0.85 | | UintBigint32 x 100000 serialize | 2.8839 ms/op | 2.9962 ms/op | 0.96 | | UintBigint64 x 100000 deserialize | 4.3039 ms/op | 4.1962 ms/op | 1.03 | | UintBigint64 x 100000 serialize | 1.5785 ms/op | 1.5403 ms/op | 1.02 | | UintBigint128 x 100000 deserialize | 5.6650 ms/op | 5.2387 ms/op | 1.08 | | UintBigint128 x 100000 serialize | 15.060 ms/op | 14.658 ms/op | 1.03 | | UintBigint256 x 100000 deserialize | 8.9617 ms/op | 8.5338 ms/op | 1.05 | | UintBigint256 x 100000 serialize | 44.122 ms/op | 43.360 ms/op | 1.02 | | Slice from Uint8Array x25000 | 1.3717 ms/op | 1.2160 ms/op | 1.13 | | Slice from ArrayBuffer x25000 | 16.008 ms/op | 15.788 ms/op | 1.01 | | Slice from ArrayBuffer x25000 + new Uint8Array | 15.412 ms/op | 17.359 ms/op | 0.89 | | Copy Uint8Array 100000 iterate | 1.6602 ms/op | 1.7065 ms/op | 0.97 | | Copy Uint8Array 100000 slice | 113.96 us/op | 131.01 us/op | 0.87 | | Copy Uint8Array 100000 Uint8Array.prototype.slice.call | 112.39 us/op | 119.91 us/op | 0.94 | | Copy Buffer 100000 Uint8Array.prototype.slice.call | 112.44 us/op | 116.62 us/op | 0.96 | | Copy Uint8Array 100000 slice + set | 173.74 us/op | 221.07 us/op | 0.79 | | Copy Uint8Array 100000 subarray + set | 112.47 us/op | 114.50 us/op | 0.98 | | Copy Uint8Array 100000 slice arrayBuffer | 113.25 us/op | 117.04 us/op | 0.97 | | Uint64 deserialize 100000 - iterate Uint8Array | 1.8023 ms/op | 1.8882 ms/op | 0.95 | | Uint64 deserialize 100000 - by Uint32A | 1.9500 ms/op | 2.0486 ms/op | 0.95 | | Uint64 deserialize 100000 - by DataView.getUint32 x2 | 1.8351 ms/op | 2.1332 ms/op | 0.86 | | Uint64 deserialize 100000 - by DataView.getBigUint64 | 4.9341 ms/op | 5.3102 ms/op | 0.93 | | Uint64 deserialize 100000 - by byte | 39.864 ms/op | 40.211 ms/op | 0.99 |

by benchmarkbot/action

twoeths commented 1 week ago

@wemeetagain a summary of the changes I made: