Skip to content

Commit

Permalink
fix: handle setBitOr in ListBasicTreeViewDU.sliceTo() (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Oct 4, 2023
1 parent e84686b commit 5c5242a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
11 changes: 7 additions & 4 deletions packages/ssz/src/viewDU/listBasic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ export class ListBasicTreeViewDU<ElementType extends BasicType<unknown>> extends
const chunkIndex = Math.floor(index / this.type.itemsPerChunk);
const nodePrev = (this.nodes[chunkIndex] ?? getNodeAtDepth(rootNode, this.type.depth, chunkIndex)) as LeafNode;

const nodeChanged = nodePrev.clone();
// set remaining items in the same chunk to 0
for (let i = index + 1; i < (chunkIndex + 1) * this.type.itemsPerChunk; i++) {
this.type.elementType.tree_setToPackedNode(nodeChanged, i, 0);
// we can't set remaining items in the same chunk to 0 with tree_setToPackedNode api due to setBitwiseOR in UintNumberType
// instead, we set the same value in nodePrev up until index
const nodeChanged = LeafNode.fromZero();
for (let i = chunkIndex * this.type.itemsPerChunk; i <= index; i++) {
const prevValue = this.type.elementType.tree_getFromPackedNode(nodePrev, i);
this.type.elementType.tree_setToPackedNode(nodeChanged, i, prevValue);
}

const chunksNode = this.type.tree_getChunksNode(this._rootNode);
let newChunksNode = setNodesAtDepth(chunksNode, this.type.chunkDepth, [chunkIndex], [nodeChanged]);
// also do the treeZeroAfterIndex operation on the chunks tree
Expand Down
42 changes: 22 additions & 20 deletions packages/ssz/test/unit/byType/listBasic/tree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,26 @@ describe("ListBasicType drop caches", () => {
});

describe("ListBasicType.sliceTo", () => {
// same to BeaconState InactivityScores
it("Slice List at multiple length", () => {
const listType = new ListBasicType(new UintNumberType(8), 100);
const listView = listType.defaultViewDU();
const listRoots: string[] = [];
const listSerialized: string[] = [];

for (let i = 0; i < 16; i++) {
listView.push(i);
listSerialized[i] = toHexString(listView.serialize());
listRoots[i] = toHexString(listView.hashTreeRoot());
}

for (let i = 0; i < 16; i++) {
const listSlice = listView.sliceTo(i);
expect(listSlice.length).to.equal(i + 1, `Wrong length at .sliceTo(${i})`);
expect(toHexString(listSlice.serialize())).equals(listSerialized[i], `Wrong serialize at .sliceTo(${i})`);
expect(toHexString(listSlice.hashTreeRoot())).equals(listRoots[i], `Wrong root at .sliceTo(${i})`);
}
});
// same to BeaconState inactivityScores and previousEpochParticipation
for (const elementType of [new UintNumberType(8), new UintNumberType(1, {setBitwiseOR: true})]) {
it(`Slice list of ${elementType.typeName} at multiple length`, () => {
const listType = new ListBasicType(elementType, 100);
const listView = listType.defaultViewDU();
const listRoots: string[] = [];
const listSerialized: string[] = [];

for (let i = 0; i < 16; i++) {
listView.push(i);
listSerialized[i] = toHexString(listView.serialize());
listRoots[i] = toHexString(listView.hashTreeRoot());
}

for (let i = 0; i < 16; i++) {
const listSlice = listView.sliceTo(i);
expect(listSlice.length).to.equal(i + 1, `Wrong length at .sliceTo(${i})`);
expect(toHexString(listSlice.serialize())).equals(listSerialized[i], `Wrong serialize at .sliceTo(${i})`);
expect(toHexString(listSlice.hashTreeRoot())).equals(listRoots[i], `Wrong root at .sliceTo(${i})`);
}
});
}
});

1 comment on commit 5c5242a

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 5c5242a Previous: e84686b Ratio
get_exitEpoch - ContainerType 4.6050 us/op 499.00 ns/op 9.23
Full benchmark results
Benchmark suite Current: 5c5242a Previous: e84686b Ratio
digestTwoHashObjects 50023 times 69.998 ms/op 69.640 ms/op 1.01
digest64 50023 times 72.038 ms/op 71.442 ms/op 1.01
digest 50023 times 72.015 ms/op 71.279 ms/op 1.01
input length 32 1.6140 us/op 1.6200 us/op 1.00
input length 64 1.8430 us/op 1.8480 us/op 1.00
input length 128 3.1970 us/op 3.1610 us/op 1.01
input length 256 4.8910 us/op 4.7760 us/op 1.02
input length 512 8.1580 us/op 8.0080 us/op 1.02
input length 1024 15.934 us/op 15.714 us/op 1.01
digest 1000000 times 1.1814 s/op 1.1396 s/op 1.04
hashObjectToByteArray 50023 times 1.9987 ms/op 1.9773 ms/op 1.01
byteArrayToHashObject 50023 times 2.1754 ms/op 2.5535 ms/op 0.85
getGindicesAtDepth 5.4580 us/op 5.6100 us/op 0.97
iterateAtDepth 11.594 us/op 11.813 us/op 0.98
getGindexBits 581.00 ns/op 591.00 ns/op 0.98
gindexIterator 1.3840 us/op 1.4300 us/op 0.97
hash 2 Uint8Array 2250026 times - as-sha256 3.2153 s/op 3.3163 s/op 0.97
hashTwoObjects 2250026 times - as-sha256 3.1043 s/op 3.1522 s/op 0.98
hash 2 Uint8Array 2250026 times - noble 9.2133 s/op 11.713 s/op 0.79
hashTwoObjects 2250026 times - noble 11.708 s/op 13.850 s/op 0.85
getNodeH() x7812.5 avg hindex 20.801 us/op 21.392 us/op 0.97
getNodeH() x7812.5 index 0 6.7240 us/op 7.2730 us/op 0.92
getNodeH() x7812.5 index 7 6.7570 us/op 7.3710 us/op 0.92
getNodeH() x7812.5 index 7 with key array 6.8690 us/op 7.2650 us/op 0.95
new LeafNode() x7812.5 301.91 us/op 340.86 us/op 0.89
multiproof - depth 15, 1 requested leaves 15.161 us/op 19.122 us/op 0.79
tree offset multiproof - depth 15, 1 requested leaves 32.793 us/op 44.235 us/op 0.74
compact multiproof - depth 15, 1 requested leaves 8.1070 us/op 12.387 us/op 0.65
multiproof - depth 15, 2 requested leaves 19.026 us/op 24.270 us/op 0.78
tree offset multiproof - depth 15, 2 requested leaves 34.653 us/op 44.701 us/op 0.78
compact multiproof - depth 15, 2 requested leaves 4.6750 us/op 4.9290 us/op 0.95
multiproof - depth 15, 3 requested leaves 25.859 us/op 32.789 us/op 0.79
tree offset multiproof - depth 15, 3 requested leaves 44.358 us/op 56.288 us/op 0.79
compact multiproof - depth 15, 3 requested leaves 8.2450 us/op 12.942 us/op 0.64
multiproof - depth 15, 4 requested leaves 34.111 us/op 42.076 us/op 0.81
tree offset multiproof - depth 15, 4 requested leaves 54.941 us/op 68.926 us/op 0.80
compact multiproof - depth 15, 4 requested leaves 9.0750 us/op 14.147 us/op 0.64
packedRootsBytesToLeafNodes bytes 4000 offset 0 3.0570 us/op 4.1540 us/op 0.74
packedRootsBytesToLeafNodes bytes 4000 offset 1 2.9430 us/op 4.3710 us/op 0.67
packedRootsBytesToLeafNodes bytes 4000 offset 2 2.9940 us/op 4.5130 us/op 0.66
packedRootsBytesToLeafNodes bytes 4000 offset 3 2.9360 us/op 4.2880 us/op 0.68
subtreeFillToContents depth 40 count 250000 77.647 ms/op 77.619 ms/op 1.00
setRoot - gindexBitstring 12.332 ms/op 17.320 ms/op 0.71
setRoot - gindex 14.162 ms/op 18.932 ms/op 0.75
getRoot - gindexBitstring 3.0714 ms/op 3.2683 ms/op 0.94
getRoot - gindex 4.3611 ms/op 4.4088 ms/op 0.99
getHashObject then setHashObject 15.811 ms/op 20.609 ms/op 0.77
setNodeWithFn 13.187 ms/op 19.001 ms/op 0.69
getNodeAtDepth depth 0 x100000 1.6151 ms/op 1.6208 ms/op 1.00
setNodeAtDepth depth 0 x100000 3.8510 ms/op 4.7174 ms/op 0.82
getNodesAtDepth depth 0 x100000 1.4193 ms/op 1.4180 ms/op 1.00
setNodesAtDepth depth 0 x100000 1.9588 ms/op 1.9757 ms/op 0.99
getNodeAtDepth depth 1 x100000 1.7407 ms/op 1.7420 ms/op 1.00
setNodeAtDepth depth 1 x100000 8.1749 ms/op 10.341 ms/op 0.79
getNodesAtDepth depth 1 x100000 1.5972 ms/op 1.5900 ms/op 1.00
setNodesAtDepth depth 1 x100000 6.8167 ms/op 7.8267 ms/op 0.87
getNodeAtDepth depth 2 x100000 2.1791 ms/op 2.2008 ms/op 0.99
setNodeAtDepth depth 2 x100000 13.557 ms/op 16.633 ms/op 0.82
getNodesAtDepth depth 2 x100000 27.167 ms/op 27.029 ms/op 1.01
setNodesAtDepth depth 2 x100000 19.388 ms/op 22.592 ms/op 0.86
tree.getNodesAtDepth - gindexes 8.0906 ms/op 9.2697 ms/op 0.87
tree.getNodesAtDepth - push all nodes 2.5831 ms/op 3.9816 ms/op 0.65
tree.getNodesAtDepth - navigation 201.41 us/op 201.60 us/op 1.00
tree.setNodesAtDepth - indexes 514.63 us/op 595.56 us/op 0.86
set at depth 8 770.00 ns/op 837.00 ns/op 0.92
set at depth 16 1.0730 us/op 1.2230 us/op 0.88
set at depth 32 1.5850 us/op 1.9870 us/op 0.80
iterateNodesAtDepth 8 256 19.179 us/op 19.431 us/op 0.99
getNodesAtDepth 8 256 4.6550 us/op 4.7080 us/op 0.99
iterateNodesAtDepth 16 65536 5.5630 ms/op 5.6873 ms/op 0.98
getNodesAtDepth 16 65536 2.2936 ms/op 3.3143 ms/op 0.69
iterateNodesAtDepth 32 250000 20.565 ms/op 21.282 ms/op 0.97
getNodesAtDepth 32 250000 5.9578 ms/op 7.6401 ms/op 0.78
iterateNodesAtDepth 40 250000 20.549 ms/op 21.180 ms/op 0.97
getNodesAtDepth 40 250000 6.0014 ms/op 7.6130 ms/op 0.79
250k validators 12.214 s/op 14.895 s/op 0.82
bitlist bytes to struct (120,90) 974.00 ns/op 1.2270 us/op 0.79
bitlist bytes to tree (120,90) 3.5110 us/op 4.5530 us/op 0.77
bitlist bytes to struct (2048,2048) 1.9990 us/op 2.4060 us/op 0.83
bitlist bytes to tree (2048,2048) 7.0400 us/op 9.1870 us/op 0.77
ByteListType - deserialize 17.280 ms/op 18.304 ms/op 0.94
BasicListType - deserialize 12.191 ms/op 24.643 ms/op 0.49
ByteListType - serialize 16.425 ms/op 17.970 ms/op 0.91
BasicListType - serialize 19.516 ms/op 23.425 ms/op 0.83
BasicListType - tree_convertToStruct 45.187 ms/op 46.087 ms/op 0.98
List[uint8, 68719476736] len 300000 ViewDU.getAll() + iterate 4.6202 ms/op 5.8787 ms/op 0.79
List[uint8, 68719476736] len 300000 ViewDU.get(i) 4.6181 ms/op 3.9596 ms/op 1.17
Array.push len 300000 empty Array - number 8.5740 ms/op 8.9562 ms/op 0.96
Array.set len 300000 from new Array - number 2.1908 ms/op 2.8931 ms/op 0.76
Array.set len 300000 - number 7.6841 ms/op 8.5705 ms/op 0.90
Uint8Array.set len 300000 242.32 us/op 244.99 us/op 0.99
Uint32Array.set len 300000 348.62 us/op 855.64 us/op 0.41
Container({a: uint8, b: uint8}) getViewDU x300000 31.758 ms/op 90.326 ms/op 0.35
ContainerNodeStruct({a: uint8, b: uint8}) getViewDU x300000 12.330 ms/op 19.500 ms/op 0.63
List(Container) len 300000 ViewDU.getAllReadonly() + iterate 493.58 ms/op 516.28 ms/op 0.96
List(Container) len 300000 ViewDU.getAllReadonlyValues() + iterate 441.42 ms/op 512.58 ms/op 0.86
List(Container) len 300000 ViewDU.get(i) 9.6258 ms/op 12.859 ms/op 0.75
List(Container) len 300000 ViewDU.getReadonly(i) 9.5717 ms/op 12.478 ms/op 0.77
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonly() + iterate 53.864 ms/op 52.480 ms/op 1.03
List(ContainerNodeStruct) len 300000 ViewDU.getAllReadonlyValues() + iterate 7.7656 ms/op 9.2981 ms/op 0.84
List(ContainerNodeStruct) len 300000 ViewDU.get(i) 9.0528 ms/op 11.831 ms/op 0.77
List(ContainerNodeStruct) len 300000 ViewDU.getReadonly(i) 8.7676 ms/op 11.868 ms/op 0.74
Array.push len 300000 empty Array - object 8.2004 ms/op 9.0278 ms/op 0.91
Array.set len 300000 from new Array - object 2.7479 ms/op 4.4876 ms/op 0.61
Array.set len 300000 - object 7.9597 ms/op 8.6700 ms/op 0.92
cachePermanentRootStruct no cache 13.838 us/op 14.158 us/op 0.98
cachePermanentRootStruct with cache 317.00 ns/op 331.00 ns/op 0.96
epochParticipation len 250000 rws 7813 3.1750 ms/op 3.2972 ms/op 0.96
deserialize Attestation - tree 4.6020 us/op 5.0580 us/op 0.91
deserialize Attestation - struct 3.1590 us/op 3.3920 us/op 0.93
deserialize SignedAggregateAndProof - tree 6.0020 us/op 6.6690 us/op 0.90
deserialize SignedAggregateAndProof - struct 4.8070 us/op 5.2780 us/op 0.91
deserialize SyncCommitteeMessage - tree 1.8130 us/op 1.8650 us/op 0.97
deserialize SyncCommitteeMessage - struct 2.0140 us/op 2.2270 us/op 0.90
deserialize SignedContributionAndProof - tree 3.0750 us/op 3.2250 us/op 0.95
deserialize SignedContributionAndProof - struct 4.4790 us/op 4.8430 us/op 0.92
deserialize SignedBeaconBlock - tree 334.57 us/op 373.80 us/op 0.90
deserialize SignedBeaconBlock - struct 224.40 us/op 237.65 us/op 0.94
BeaconState vc 300000 - deserialize tree 838.93 ms/op 887.00 ms/op 0.95
BeaconState vc 300000 - serialize tree 277.73 ms/op 171.89 ms/op 1.62
BeaconState.historicalRoots vc 300000 - deserialize tree 1.3700 us/op 1.2700 us/op 1.08
BeaconState.historicalRoots vc 300000 - serialize tree 1.3110 us/op 1.4860 us/op 0.88
BeaconState.validators vc 300000 - deserialize tree 875.60 ms/op 909.78 ms/op 0.96
BeaconState.validators vc 300000 - serialize tree 201.51 ms/op 231.37 ms/op 0.87
BeaconState.balances vc 300000 - deserialize tree 32.241 ms/op 36.016 ms/op 0.90
BeaconState.balances vc 300000 - serialize tree 4.6928 ms/op 6.6848 ms/op 0.70
BeaconState.previousEpochParticipation vc 300000 - deserialize tree 696.88 us/op 843.05 us/op 0.83
BeaconState.previousEpochParticipation vc 300000 - serialize tree 361.32 us/op 367.13 us/op 0.98
BeaconState.currentEpochParticipation vc 300000 - deserialize tree 653.01 us/op 845.53 us/op 0.77
BeaconState.currentEpochParticipation vc 300000 - serialize tree 354.54 us/op 368.00 us/op 0.96
BeaconState.inactivityScores vc 300000 - deserialize tree 41.347 ms/op 39.482 ms/op 1.05
BeaconState.inactivityScores vc 300000 - serialize tree 3.5941 ms/op 6.2821 ms/op 0.57
hashTreeRoot Attestation - struct 41.847 us/op 62.534 us/op 0.67
hashTreeRoot Attestation - tree 29.583 us/op 36.662 us/op 0.81
hashTreeRoot SignedAggregateAndProof - struct 65.688 us/op 80.505 us/op 0.82
hashTreeRoot SignedAggregateAndProof - tree 40.592 us/op 42.173 us/op 0.96
hashTreeRoot SyncCommitteeMessage - struct 13.894 us/op 19.243 us/op 0.72
hashTreeRoot SyncCommitteeMessage - tree 9.1560 us/op 9.2080 us/op 0.99
hashTreeRoot SignedContributionAndProof - struct 38.804 us/op 52.834 us/op 0.73
hashTreeRoot SignedContributionAndProof - tree 29.025 us/op 32.714 us/op 0.89
hashTreeRoot SignedBeaconBlock - struct 3.4679 ms/op 4.0247 ms/op 0.86
hashTreeRoot SignedBeaconBlock - tree 2.4238 ms/op 2.4251 ms/op 1.00
hashTreeRoot Validator - struct 19.356 us/op 20.929 us/op 0.92
hashTreeRoot Validator - tree 15.888 us/op 16.553 us/op 0.96
BeaconState vc 300000 - hashTreeRoot tree 5.1553 s/op 5.2684 s/op 0.98
BeaconState.historicalRoots vc 300000 - hashTreeRoot tree 2.0320 us/op 2.1450 us/op 0.95
BeaconState.validators vc 300000 - hashTreeRoot tree 4.9387 s/op 5.0272 s/op 0.98
BeaconState.balances vc 300000 - hashTreeRoot tree 125.27 ms/op 128.95 ms/op 0.97
BeaconState.previousEpochParticipation vc 300000 - hashTreeRoot tree 13.161 ms/op 13.223 ms/op 1.00
BeaconState.currentEpochParticipation vc 300000 - hashTreeRoot tree 13.165 ms/op 13.217 ms/op 1.00
BeaconState.inactivityScores vc 300000 - hashTreeRoot tree 135.27 ms/op 132.71 ms/op 1.02
hash64 x18 27.837 us/op 28.626 us/op 0.97
hashTwoObjects x18 26.007 us/op 27.366 us/op 0.95
hash64 x1740 2.6114 ms/op 2.7316 ms/op 0.96
hashTwoObjects x1740 2.4571 ms/op 2.5517 ms/op 0.96
hash64 x2700000 4.0627 s/op 4.2206 s/op 0.96
hashTwoObjects x2700000 3.8030 s/op 4.0114 s/op 0.95
get_exitEpoch - ContainerType 4.6050 us/op 499.00 ns/op 9.23
get_exitEpoch - ContainerNodeStructType 433.00 ns/op 431.00 ns/op 1.00
set_exitEpoch - ContainerType 446.00 ns/op 492.00 ns/op 0.91
set_exitEpoch - ContainerNodeStructType 412.00 ns/op 436.00 ns/op 0.94
get_pubkey - ContainerType 1.9870 us/op 2.1220 us/op 0.94
get_pubkey - ContainerNodeStructType 423.00 ns/op 332.00 ns/op 1.27
hashTreeRoot - ContainerType 698.00 ns/op 549.00 ns/op 1.27
hashTreeRoot - ContainerNodeStructType 761.00 ns/op 641.00 ns/op 1.19
createProof - ContainerType 6.6320 us/op 7.4480 us/op 0.89
createProof - ContainerNodeStructType 33.138 us/op 38.563 us/op 0.86
serialize - ContainerType 2.9940 us/op 3.3850 us/op 0.88
serialize - ContainerNodeStructType 2.3890 us/op 2.8770 us/op 0.83
set_exitEpoch_and_hashTreeRoot - ContainerType 6.0810 us/op 6.8070 us/op 0.89
set_exitEpoch_and_hashTreeRoot - ContainerNodeStructType 16.635 us/op 18.551 us/op 0.90
Array - for of 8.9450 us/op 11.363 us/op 0.79
Array - for(;;) 8.6570 us/op 10.086 us/op 0.86
basicListValue.readonlyValuesArray() 4.4756 ms/op 5.7984 ms/op 0.77
basicListValue.readonlyValuesArray() + loop all 4.5805 ms/op 5.8478 ms/op 0.78
compositeListValue.readonlyValuesArray() 34.605 ms/op 35.673 ms/op 0.97
compositeListValue.readonlyValuesArray() + loop all 32.660 ms/op 34.679 ms/op 0.94
Number64UintType - get balances list 1.5781 ms/op 1.5278 ms/op 1.03
Number64UintType - set balances list 11.917 ms/op 14.280 ms/op 0.83
Number64UintType - get and increase 10 then set 43.438 ms/op 47.910 ms/op 0.91
Number64UintType - increase 10 using applyDelta 15.231 ms/op 17.831 ms/op 0.85
Number64UintType - increase 10 using applyDeltaInBatch 14.971 ms/op 17.980 ms/op 0.83
tree_newTreeFromUint64Deltas 23.424 ms/op 25.369 ms/op 0.92
unsafeUint8ArrayToTree 41.735 ms/op 43.844 ms/op 0.95
bitLength(50) 321.00 ns/op 307.00 ns/op 1.05
bitLengthStr(50) 343.00 ns/op 344.00 ns/op 1.00
bitLength(8000) 316.00 ns/op 296.00 ns/op 1.07
bitLengthStr(8000) 402.00 ns/op 405.00 ns/op 0.99
bitLength(250000) 307.00 ns/op 292.00 ns/op 1.05
bitLengthStr(250000) 456.00 ns/op 461.00 ns/op 0.99
floor - Math.floor (53) 0.60294 ns/op 0.60311 ns/op 1.00
floor - << 0 (53) 0.60284 ns/op 0.60311 ns/op 1.00
floor - Math.floor (512) 0.60264 ns/op 0.60313 ns/op 1.00
floor - << 0 (512) 0.60289 ns/op 0.60293 ns/op 1.00
fnIf(0) 2.0083 ns/op 2.0091 ns/op 1.00
fnSwitch(0) 3.3978 ns/op 3.3247 ns/op 1.02
fnObj(0) 0.60286 ns/op 0.60305 ns/op 1.00
fnArr(0) 0.60289 ns/op 0.60303 ns/op 1.00
fnIf(4) 3.1871 ns/op 3.1700 ns/op 1.01
fnSwitch(4) 3.4053 ns/op 3.3097 ns/op 1.03
fnObj(4) 0.60286 ns/op 0.60355 ns/op 1.00
fnArr(4) 0.60280 ns/op 0.60322 ns/op 1.00
fnIf(9) 5.2256 ns/op 5.2277 ns/op 1.00
fnSwitch(9) 3.3744 ns/op 3.3230 ns/op 1.02
fnObj(9) 0.60272 ns/op 0.60304 ns/op 1.00
fnArr(9) 0.60272 ns/op 0.60316 ns/op 1.00
Container {a,b,vec} - as struct x100000 60.513 us/op 60.557 us/op 1.00
Container {a,b,vec} - as tree x100000 498.08 us/op 501.76 us/op 0.99
Container {a,vec,b} - as struct x100000 120.74 us/op 120.85 us/op 1.00
Container {a,vec,b} - as tree x100000 554.05 us/op 549.33 us/op 1.01
get 2 props x1000000 - rawObject 401.92 us/op 402.17 us/op 1.00
get 2 props x1000000 - proxy 93.803 ms/op 93.786 ms/op 1.00
get 2 props x1000000 - customObj 401.93 us/op 402.13 us/op 1.00
Simple object binary -> struct 1.0640 us/op 812.00 ns/op 1.31
Simple object binary -> tree_backed 2.8650 us/op 2.5560 us/op 1.12
Simple object struct -> tree_backed 4.0550 us/op 3.3900 us/op 1.20
Simple object tree_backed -> struct 3.4730 us/op 2.8730 us/op 1.21
Simple object struct -> binary 1.7430 us/op 1.6810 us/op 1.04
Simple object tree_backed -> binary 2.7880 us/op 2.6940 us/op 1.03
aggregationBits binary -> struct 911.00 ns/op 764.00 ns/op 1.19
aggregationBits binary -> tree_backed 3.8960 us/op 3.7540 us/op 1.04
aggregationBits struct -> tree_backed 4.6510 us/op 4.7720 us/op 0.97
aggregationBits tree_backed -> struct 1.9680 us/op 2.0000 us/op 0.98
aggregationBits struct -> binary 1.4310 us/op 1.4700 us/op 0.97
aggregationBits tree_backed -> binary 1.7530 us/op 1.7870 us/op 0.98
List(uint8) 100000 binary -> struct 1.8263 ms/op 2.3199 ms/op 0.79
List(uint8) 100000 binary -> tree_backed 138.47 us/op 199.17 us/op 0.70
List(uint8) 100000 struct -> tree_backed 1.7226 ms/op 1.8762 ms/op 0.92
List(uint8) 100000 tree_backed -> struct 1.2382 ms/op 1.2985 ms/op 0.95
List(uint8) 100000 struct -> binary 1.5630 ms/op 1.6699 ms/op 0.94
List(uint8) 100000 tree_backed -> binary 93.805 us/op 95.004 us/op 0.99
List(uint64Number) 100000 binary -> struct 1.5458 ms/op 1.5554 ms/op 0.99
List(uint64Number) 100000 binary -> tree_backed 4.7192 ms/op 4.9065 ms/op 0.96
List(uint64Number) 100000 struct -> tree_backed 6.7476 ms/op 6.7767 ms/op 1.00
List(uint64Number) 100000 tree_backed -> struct 2.6547 ms/op 2.9888 ms/op 0.89
List(uint64Number) 100000 struct -> binary 2.0306 ms/op 1.9983 ms/op 1.02
List(uint64Number) 100000 tree_backed -> binary 1.0072 ms/op 1.5214 ms/op 0.66
List(Uint64Bigint) 100000 binary -> struct 4.8420 ms/op 4.7295 ms/op 1.02
List(Uint64Bigint) 100000 binary -> tree_backed 4.7200 ms/op 5.8863 ms/op 0.80
List(Uint64Bigint) 100000 struct -> tree_backed 7.7328 ms/op 8.5808 ms/op 0.90
List(Uint64Bigint) 100000 tree_backed -> struct 6.0175 ms/op 6.0092 ms/op 1.00
List(Uint64Bigint) 100000 struct -> binary 2.6382 ms/op 2.6454 ms/op 1.00
List(Uint64Bigint) 100000 tree_backed -> binary 1.2158 ms/op 1.5102 ms/op 0.81
Vector(Root) 100000 binary -> struct 50.645 ms/op 45.877 ms/op 1.10
Vector(Root) 100000 binary -> tree_backed 51.027 ms/op 46.044 ms/op 1.11
Vector(Root) 100000 struct -> tree_backed 58.372 ms/op 60.586 ms/op 0.96
Vector(Root) 100000 tree_backed -> struct 63.002 ms/op 67.568 ms/op 0.93
Vector(Root) 100000 struct -> binary 2.6083 ms/op 2.6919 ms/op 0.97
Vector(Root) 100000 tree_backed -> binary 11.422 ms/op 12.121 ms/op 0.94
List(Validator) 100000 binary -> struct 177.06 ms/op 182.60 ms/op 0.97
List(Validator) 100000 binary -> tree_backed 483.88 ms/op 481.34 ms/op 1.01
List(Validator) 100000 struct -> tree_backed 508.91 ms/op 518.40 ms/op 0.98
List(Validator) 100000 tree_backed -> struct 273.48 ms/op 282.74 ms/op 0.97
List(Validator) 100000 struct -> binary 41.012 ms/op 41.056 ms/op 1.00
List(Validator) 100000 tree_backed -> binary 113.44 ms/op 116.43 ms/op 0.97
List(Validator-NS) 100000 binary -> struct 181.10 ms/op 170.53 ms/op 1.06
List(Validator-NS) 100000 binary -> tree_backed 243.44 ms/op 249.82 ms/op 0.97
List(Validator-NS) 100000 struct -> tree_backed 297.89 ms/op 305.25 ms/op 0.98
List(Validator-NS) 100000 tree_backed -> struct 241.68 ms/op 251.05 ms/op 0.96
List(Validator-NS) 100000 struct -> binary 41.059 ms/op 40.810 ms/op 1.01
List(Validator-NS) 100000 tree_backed -> binary 46.618 ms/op 48.117 ms/op 0.97
get epochStatuses - MutableVector 100.04 us/op 102.50 us/op 0.98
get epochStatuses - ViewDU 241.03 us/op 249.10 us/op 0.97
set epochStatuses - ListTreeView 1.9437 ms/op 1.9878 ms/op 0.98
set epochStatuses - ListTreeView - set() 602.09 us/op 607.96 us/op 0.99
set epochStatuses - ListTreeView - commit() 551.09 us/op 606.13 us/op 0.91
bitstring 923.08 ns/op 924.80 ns/op 1.00
bit mask 14.487 ns/op 14.505 ns/op 1.00
struct - increase slot to 1000000 1.8931 ms/op 1.7149 ms/op 1.10
UintNumberType - increase slot to 1000000 36.964 ms/op 36.459 ms/op 1.01
UintBigintType - increase slot to 1000000 571.84 ms/op 573.75 ms/op 1.00
UintBigint8 x 100000 tree_deserialize 5.5456 ms/op 5.6404 ms/op 0.98
UintBigint8 x 100000 tree_serialize 1.1480 ms/op 741.42 us/op 1.55
UintBigint16 x 100000 tree_deserialize 5.1609 ms/op 5.4073 ms/op 0.95
UintBigint16 x 100000 tree_serialize 2.0151 ms/op 1.7411 ms/op 1.16
UintBigint32 x 100000 tree_deserialize 6.3096 ms/op 7.1271 ms/op 0.89
UintBigint32 x 100000 tree_serialize 1.5897 ms/op 2.3093 ms/op 0.69
UintBigint64 x 100000 tree_deserialize 6.5380 ms/op 7.8230 ms/op 0.84
UintBigint64 x 100000 tree_serialize 2.0794 ms/op 2.2974 ms/op 0.91
UintBigint8 x 100000 value_deserialize 541.67 us/op 538.58 us/op 1.01
UintBigint8 x 100000 value_serialize 921.93 us/op 1.1142 ms/op 0.83
UintBigint16 x 100000 value_deserialize 581.27 us/op 584.66 us/op 0.99
UintBigint16 x 100000 value_serialize 976.47 us/op 1.1745 ms/op 0.83
UintBigint32 x 100000 value_deserialize 539.90 us/op 544.10 us/op 0.99
UintBigint32 x 100000 value_serialize 960.74 us/op 1.1859 ms/op 0.81
UintBigint64 x 100000 value_deserialize 613.33 us/op 610.01 us/op 1.01
UintBigint64 x 100000 value_serialize 1.2218 ms/op 1.4237 ms/op 0.86
UintBigint8 x 100000 deserialize 6.3938 ms/op 6.3625 ms/op 1.00
UintBigint8 x 100000 serialize 1.9289 ms/op 2.0128 ms/op 0.96
UintBigint16 x 100000 deserialize 6.0533 ms/op 5.7809 ms/op 1.05
UintBigint16 x 100000 serialize 1.9870 ms/op 2.0700 ms/op 0.96
UintBigint32 x 100000 deserialize 7.2425 ms/op 7.3565 ms/op 0.98
UintBigint32 x 100000 serialize 3.8573 ms/op 3.7060 ms/op 1.04
UintBigint64 x 100000 deserialize 4.8229 ms/op 5.0727 ms/op 0.95
UintBigint64 x 100000 serialize 1.9024 ms/op 1.9048 ms/op 1.00
UintBigint128 x 100000 deserialize 7.6985 ms/op 7.4742 ms/op 1.03
UintBigint128 x 100000 serialize 21.665 ms/op 22.855 ms/op 0.95
UintBigint256 x 100000 deserialize 13.797 ms/op 14.489 ms/op 0.95
UintBigint256 x 100000 serialize 65.014 ms/op 66.575 ms/op 0.98
Slice from Uint8Array x25000 1.3632 ms/op 1.5749 ms/op 0.87
Slice from ArrayBuffer x25000 27.835 ms/op 28.754 ms/op 0.97
Slice from ArrayBuffer x25000 + new Uint8Array 32.570 ms/op 32.209 ms/op 1.01
Copy Uint8Array 100000 iterate 1.0621 ms/op 1.0772 ms/op 0.99
Copy Uint8Array 100000 slice 102.88 us/op 133.88 us/op 0.77
Copy Uint8Array 100000 Uint8Array.prototype.slice.call 280.73 us/op 133.25 us/op 2.11
Copy Buffer 100000 Uint8Array.prototype.slice.call 288.01 us/op 132.24 us/op 2.18
Copy Uint8Array 100000 slice + set 556.43 us/op 280.22 us/op 1.99
Copy Uint8Array 100000 subarray + set 280.93 us/op 132.77 us/op 2.12
Copy Uint8Array 100000 slice arrayBuffer 280.97 us/op 135.50 us/op 2.07
Uint64 deserialize 100000 - iterate Uint8Array 2.1028 ms/op 2.2426 ms/op 0.94
Uint64 deserialize 100000 - by Uint32A 2.0150 ms/op 2.1752 ms/op 0.93
Uint64 deserialize 100000 - by DataView.getUint32 x2 1.9891 ms/op 2.1691 ms/op 0.92
Uint64 deserialize 100000 - by DataView.getBigUint64 5.9090 ms/op 6.0728 ms/op 0.97
Uint64 deserialize 100000 - by byte 72.899 ms/op 72.904 ms/op 1.00

Please sign in to comment.