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: swap blst for napi library #6350

Closed
wants to merge 9 commits into from
Closed

Conversation

matthewkeil
Copy link
Member

@matthewkeil matthewkeil commented Jan 24, 2024

Motivation

DRAFT PR. Not ready for full review.

NOTE: most of the diff is the blst-ts (with the full supranational/bls) library itself. It has not been published so all that code is brought into lodestar to test the code

Branch is deployed to feat2 to collect metrics

Description

Swaps all references to @chainsafe/bls and @chainsafe/blst with the new library @chainsafe/blst-ts

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Merging #6350 (1f2d67e) into unstable (9b44056) will increase coverage by 0.00%.
Report is 2 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #6350   +/-   ##
=========================================
  Coverage     60.13%   60.14%           
=========================================
  Files           407      407           
  Lines         46451    46462   +11     
  Branches       1534     1534           
=========================================
+ Hits          27935    27944    +9     
- Misses        18486    18488    +2     
  Partials         30       30           

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: a323553 Previous: 398be86 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 949.07 us/op 634.40 us/op 1.50
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 97.501 us/op 94.987 us/op 1.03
BLS verify - Napi 1.2740 ms/op
BLS asyncVerify - Napi 1.6092 ms/op
BLS verifyMultipleAggregateSignatures 3 - Napi 2.3739 ms/op
BLS asyncVerifyMultipleAggregateSignatures 3 - Napi 2.8637 ms/op
BLS verify multiple aggregate signatures 3 - same message - Napi 1.5419 ms/op
BLS async verify multiple aggregate signatures 3 - same message - Napi 1.8641 ms/op
BLS verifyMultipleAggregateSignatures 8 - Napi 5.0069 ms/op
BLS asyncVerifyMultipleAggregateSignatures 8 - Napi 5.3119 ms/op
BLS verify multiple aggregate signatures 8 - same message - Napi 1.9992 ms/op
BLS async verify multiple aggregate signatures 8 - same message - Napi 2.4334 ms/op
BLS verifyMultipleAggregateSignatures 32 - Napi 18.060 ms/op
BLS asyncVerifyMultipleAggregateSignatures 32 - Napi 18.435 ms/op
BLS verify multiple aggregate signatures 32 - same message - Napi 4.2473 ms/op
BLS async verify multiple aggregate signatures 32 - same message - Napi 4.9702 ms/op
BLS verifyMultipleAggregateSignatures 64 - Napi 35.523 ms/op
BLS asyncVerifyMultipleAggregateSignatures 64 - Napi 36.592 ms/op
BLS verify multiple aggregate signatures 64 - same message - Napi 7.5030 ms/op
BLS async verify multiple aggregate signatures 64 - same message - Napi 8.1663 ms/op
BLS verifyMultipleAggregateSignatures 128 - Napi 70.978 ms/op
BLS asyncVerifyMultipleAggregateSignatures 128 - Napi 71.561 ms/op
BLS verify multiple aggregate signatures 128 - same message - Napi 13.407 ms/op
BLS async verify multiple aggregate signatures 128 - same message - Napi 13.891 ms/op
BLS aggregatePubkeys 4 - Napi 5.2080 us/op
BLS aggregatePubkeys 32 - Napi 32.889 us/op
BLS aggregatePubkeys 128 - Napi 126.67 us/op
BLS aggregatePubkeys 256 - Napi 249.66 us/op
BLS aggregatePubkeys 512 - Napi 505.51 us/op
BLS deserializing 10000 signatures 915.11 ms/op 952.28 ms/op 0.96
BLS deserializing 100000 signatures 9.0363 s/op 9.6330 s/op 0.94
getAttestationsForBlock 49.242 ms/op 55.824 ms/op 0.88
getSlashingsAndExits - default max 158.94 us/op 167.28 us/op 0.95
getSlashingsAndExits - 2k 347.18 us/op 501.40 us/op 0.69
proposeBlockBody type=full, size=empty 6.0404 ms/op 7.2484 ms/op 0.83
isKnown best case - 1 super set check 324.00 ns/op 616.00 ns/op 0.53
isKnown normal case - 2 super set checks 327.00 ns/op 639.00 ns/op 0.51
isKnown worse case - 16 super set checks 298.00 ns/op 570.00 ns/op 0.52
CheckpointStateCache - add get delete 5.1810 us/op 7.4970 us/op 0.69
validate api signedAggregateAndProof - struct 2.3689 ms/op 3.0684 ms/op 0.77
validate gossip signedAggregateAndProof - struct 2.3612 ms/op 3.1282 ms/op 0.75
validate gossip attestation - vc 640000 1.3035 ms/op 1.4892 ms/op 0.88
batch validate gossip attestation - vc 640000 - chunk 32 115.29 us/op 177.87 us/op 0.65
batch validate gossip attestation - vc 640000 - chunk 64 101.24 us/op 169.36 us/op 0.60
batch validate gossip attestation - vc 640000 - chunk 128 97.608 us/op 165.39 us/op 0.59
batch validate gossip attestation - vc 640000 - chunk 256 95.407 us/op 165.70 us/op 0.58
pickEth1Vote - no votes 1.3354 ms/op 1.4265 ms/op 0.94
pickEth1Vote - max votes 15.123 ms/op 19.109 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot value x2048 23.842 ms/op 22.488 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 32.733 ms/op 32.044 ms/op 1.02
pickEth1Vote - Eth1Data fastSerialize value x2048 742.70 us/op 784.01 us/op 0.95
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.5948 ms/op 7.4214 ms/op 0.75
bytes32 toHexString 791.00 ns/op 1.1050 us/op 0.72
bytes32 Buffer.toString(hex) 312.00 ns/op 423.00 ns/op 0.74
bytes32 Buffer.toString(hex) from Uint8Array 542.00 ns/op 671.00 ns/op 0.81
bytes32 Buffer.toString(hex) + 0x 305.00 ns/op 498.00 ns/op 0.61
Object access 1 prop 0.20500 ns/op 0.30700 ns/op 0.67
Map access 1 prop 0.15700 ns/op 0.19100 ns/op 0.82
Object get x1000 7.7780 ns/op 10.236 ns/op 0.76
Map get x1000 0.87700 ns/op 1.0290 ns/op 0.85
Object set x1000 63.126 ns/op 100.07 ns/op 0.63
Map set x1000 46.040 ns/op 65.569 ns/op 0.70
Return object 10000 times 0.26860 ns/op 0.33640 ns/op 0.80
Throw Error 10000 times 4.1721 us/op 4.7531 us/op 0.88
fastMsgIdFn sha256 / 200 bytes 3.5050 us/op 4.1380 us/op 0.85
fastMsgIdFn h32 xxhash / 200 bytes 348.00 ns/op 475.00 ns/op 0.73
fastMsgIdFn h64 xxhash / 200 bytes 394.00 ns/op 626.00 ns/op 0.63
fastMsgIdFn sha256 / 1000 bytes 11.762 us/op 14.096 us/op 0.83
fastMsgIdFn h32 xxhash / 1000 bytes 482.00 ns/op 603.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 1000 bytes 485.00 ns/op 659.00 ns/op 0.74
fastMsgIdFn sha256 / 10000 bytes 106.82 us/op 114.61 us/op 0.93
fastMsgIdFn h32 xxhash / 10000 bytes 2.1280 us/op 2.2770 us/op 0.93
fastMsgIdFn h64 xxhash / 10000 bytes 1.4530 us/op 1.5460 us/op 0.94
send data - 1000 256B messages 21.975 ms/op 29.926 ms/op 0.73
send data - 1000 512B messages 30.181 ms/op 46.719 ms/op 0.65
send data - 1000 1024B messages 46.464 ms/op 46.002 ms/op 1.01
send data - 1000 1200B messages 38.947 ms/op 48.539 ms/op 0.80
send data - 1000 2048B messages 50.286 ms/op 73.687 ms/op 0.68
send data - 1000 4096B messages 42.994 ms/op 63.367 ms/op 0.68
send data - 1000 16384B messages 124.08 ms/op 190.91 ms/op 0.65
send data - 1000 65536B messages 483.15 ms/op 754.39 ms/op 0.64
enrSubnets - fastDeserialize 64 bits 1.5560 us/op 2.8450 us/op 0.55
enrSubnets - ssz BitVector 64 bits 570.00 ns/op 688.00 ns/op 0.83
enrSubnets - fastDeserialize 4 bits 251.00 ns/op 288.00 ns/op 0.87
enrSubnets - ssz BitVector 4 bits 628.00 ns/op 660.00 ns/op 0.95
prioritizePeers score -10:0 att 32-0.1 sync 2-0 127.03 us/op 155.45 us/op 0.82
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 147.81 us/op 209.03 us/op 0.71
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 197.20 us/op 229.84 us/op 0.86
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 377.97 us/op 385.87 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 404.75 us/op 481.07 us/op 0.84
array of 16000 items push then shift 1.7705 us/op 1.8940 us/op 0.93
LinkedList of 16000 items push then shift 10.643 ns/op 12.285 ns/op 0.87
array of 16000 items push then pop 116.56 ns/op 134.41 ns/op 0.87
LinkedList of 16000 items push then pop 9.4570 ns/op 10.075 ns/op 0.94
array of 24000 items push then shift 2.6779 us/op 3.1156 us/op 0.86
LinkedList of 24000 items push then shift 9.7390 ns/op 11.180 ns/op 0.87
array of 24000 items push then pop 152.66 ns/op 176.82 ns/op 0.86
LinkedList of 24000 items push then pop 9.9120 ns/op 9.6230 ns/op 1.03
array of 1 items, for/of push(obj) 0.24600 ns/op
array of 1 items, push(...objs) 0.26800 ns/op
array of 3 items, for/of push(obj) 0.38900 ns/op
array of 3 items, push(...objs) 0.50200 ns/op
array of 5 items, for/of push(obj) 0.40300 ns/op
array of 5 items, push(...objs) 0.40900 ns/op
array of 8 items, for/of push(obj) 0.31200 ns/op
array of 8 items, push(...objs) 0.64700 ns/op
array of 10 items, for/of push(obj) 0.38700 ns/op
array of 10 items, push(...objs) 0.37200 ns/op
array of 20 items, for/of push(obj) 0.43600 ns/op
array of 20 items, push(...objs) 0.42100 ns/op
array of 30 items, for/of push(obj) 0.84100 ns/op
array of 30 items, push(...objs) 0.59300 ns/op
array of 40 items, for/of push(obj) 0.60400 ns/op
array of 40 items, push(...objs) 0.66700 ns/op
array of 50 items, for/of push(obj) 0.91200 ns/op
array of 50 items, push(...objs) 0.77000 ns/op
array of 80 items, for/of push(obj) 1.1120 ns/op
array of 80 items, push(...objs) 0.77400 ns/op
array of 100 items, for/of push(obj) 1.2760 ns/op
array of 100 items, push(...objs) 0.92900 ns/op
intersect bitArray bitLen 8 8.4820 ns/op 7.3860 ns/op 1.15
intersect array and set length 8 79.502 ns/op 89.607 ns/op 0.89
intersect bitArray bitLen 128 46.038 ns/op 37.425 ns/op 1.23
intersect array and set length 128 1.2419 us/op 1.1631 us/op 1.07
bitArray.getTrueBitIndexes() bitLen 128 1.9380 us/op 1.8840 us/op 1.03
bitArray.getTrueBitIndexes() bitLen 248 3.2740 us/op 3.3470 us/op 0.98
bitArray.getTrueBitIndexes() bitLen 512 7.2750 us/op 6.8030 us/op 1.07
Buffer.concat 32 items 1.2370 us/op 1.1570 us/op 1.07
Uint8Array.set 32 items 2.2790 us/op 2.7160 us/op 0.84
Set add up to 64 items then delete first 5.5204 us/op 5.3898 us/op 1.02
OrderedSet add up to 64 items then delete first 7.2925 us/op 7.1415 us/op 1.02
Set add up to 64 items then delete last 6.3387 us/op 5.7749 us/op 1.10
OrderedSet add up to 64 items then delete last 8.3801 us/op 7.4197 us/op 1.13
Set add up to 64 items then delete middle 6.2568 us/op 5.6392 us/op 1.11
OrderedSet add up to 64 items then delete middle 9.2666 us/op 9.5396 us/op 0.97
Set add up to 128 items then delete first 12.479 us/op 12.176 us/op 1.02
OrderedSet add up to 128 items then delete first 17.171 us/op 17.092 us/op 1.00
Set add up to 128 items then delete last 12.631 us/op 11.598 us/op 1.09
OrderedSet add up to 128 items then delete last 15.225 us/op 15.382 us/op 0.99
Set add up to 128 items then delete middle 12.174 us/op 11.666 us/op 1.04
OrderedSet add up to 128 items then delete middle 22.303 us/op 20.848 us/op 1.07
Set add up to 256 items then delete first 26.172 us/op 23.618 us/op 1.11
OrderedSet add up to 256 items then delete first 33.876 us/op 32.627 us/op 1.04
Set add up to 256 items then delete last 24.506 us/op 22.484 us/op 1.09
OrderedSet add up to 256 items then delete last 31.077 us/op 29.884 us/op 1.04
Set add up to 256 items then delete middle 25.298 us/op 23.560 us/op 1.07
OrderedSet add up to 256 items then delete middle 60.090 us/op 55.496 us/op 1.08
transfer serialized Status (84 B) 2.0660 us/op 1.9910 us/op 1.04
copy serialized Status (84 B) 1.5600 us/op 1.5110 us/op 1.03
transfer serialized SignedVoluntaryExit (112 B) 2.1360 us/op 2.1220 us/op 1.01
copy serialized SignedVoluntaryExit (112 B) 1.5870 us/op 1.5740 us/op 1.01
transfer serialized ProposerSlashing (416 B) 2.5090 us/op 3.0630 us/op 0.82
copy serialized ProposerSlashing (416 B) 2.2920 us/op 2.9460 us/op 0.78
transfer serialized Attestation (485 B) 2.6300 us/op 2.8190 us/op 0.93
copy serialized Attestation (485 B) 4.1160 us/op 2.3180 us/op 1.78
transfer serialized AttesterSlashing (33232 B) 2.5970 us/op 2.3020 us/op 1.13
copy serialized AttesterSlashing (33232 B) 16.791 us/op 8.9420 us/op 1.88
transfer serialized Small SignedBeaconBlock (128000 B) 3.9270 us/op 2.7760 us/op 1.41
copy serialized Small SignedBeaconBlock (128000 B) 29.193 us/op 29.048 us/op 1.00
transfer serialized Avg SignedBeaconBlock (200000 B) 4.9720 us/op 3.3090 us/op 1.50
copy serialized Avg SignedBeaconBlock (200000 B) 42.693 us/op 45.187 us/op 0.94
transfer serialized BlobsSidecar (524380 B) 5.8720 us/op 3.5620 us/op 1.65
copy serialized BlobsSidecar (524380 B) 146.32 us/op 197.35 us/op 0.74
transfer serialized Big SignedBeaconBlock (1000000 B) 5.2660 us/op 4.0420 us/op 1.30
copy serialized Big SignedBeaconBlock (1000000 B) 492.06 us/op 391.87 us/op 1.26
pass gossip attestations to forkchoice per slot 5.0543 ms/op 4.3567 ms/op 1.16
forkChoice updateHead vc 100000 bc 64 eq 0 819.94 us/op 705.73 us/op 1.16
forkChoice updateHead vc 600000 bc 64 eq 0 6.3173 ms/op 6.7301 ms/op 0.94
forkChoice updateHead vc 1000000 bc 64 eq 0 8.2030 ms/op 8.1654 ms/op 1.00
forkChoice updateHead vc 600000 bc 320 eq 0 4.9052 ms/op 4.4903 ms/op 1.09
forkChoice updateHead vc 600000 bc 1200 eq 0 5.4545 ms/op 4.6307 ms/op 1.18
forkChoice updateHead vc 600000 bc 7200 eq 0 6.7100 ms/op 5.5593 ms/op 1.21
forkChoice updateHead vc 600000 bc 64 eq 1000 13.950 ms/op 11.578 ms/op 1.20
forkChoice updateHead vc 600000 bc 64 eq 10000 14.486 ms/op 13.024 ms/op 1.11
forkChoice updateHead vc 600000 bc 64 eq 300000 26.506 ms/op 20.816 ms/op 1.27
computeDeltas 500000 validators 300 proto nodes 8.0779 ms/op 7.3024 ms/op 1.11
computeDeltas 500000 validators 1200 proto nodes 8.9163 ms/op 7.1152 ms/op 1.25
computeDeltas 500000 validators 7200 proto nodes 7.9565 ms/op 6.8017 ms/op 1.17
computeDeltas 750000 validators 300 proto nodes 12.015 ms/op 10.460 ms/op 1.15
computeDeltas 750000 validators 1200 proto nodes 12.410 ms/op 10.519 ms/op 1.18
computeDeltas 750000 validators 7200 proto nodes 12.460 ms/op 10.596 ms/op 1.18
computeDeltas 1400000 validators 300 proto nodes 25.682 ms/op 20.052 ms/op 1.28
computeDeltas 1400000 validators 1200 proto nodes 23.494 ms/op 21.162 ms/op 1.11
computeDeltas 1400000 validators 7200 proto nodes 21.170 ms/op 20.947 ms/op 1.01
computeDeltas 2100000 validators 300 proto nodes 29.980 ms/op 31.098 ms/op 0.96
computeDeltas 2100000 validators 1200 proto nodes 28.571 ms/op 34.531 ms/op 0.83
computeDeltas 2100000 validators 7200 proto nodes 29.739 ms/op 31.529 ms/op 0.94
altair processAttestation - 250000 vs - 7PWei normalcase 2.7723 ms/op 2.5935 ms/op 1.07
altair processAttestation - 250000 vs - 7PWei worstcase 3.8271 ms/op 3.9495 ms/op 0.97
altair processAttestation - setStatus - 1/6 committees join 192.03 us/op 193.19 us/op 0.99
altair processAttestation - setStatus - 1/3 committees join 371.30 us/op 373.80 us/op 0.99
altair processAttestation - setStatus - 1/2 committees join 494.69 us/op 534.05 us/op 0.93
altair processAttestation - setStatus - 2/3 committees join 612.36 us/op 654.99 us/op 0.93
altair processAttestation - setStatus - 4/5 committees join 857.38 us/op 858.92 us/op 1.00
altair processAttestation - setStatus - 100% committees join 989.63 us/op 1.0021 ms/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 11.561 ms/op 10.122 ms/op 1.14
altair processBlock - 250000 vs - 7PWei normalcase hashState 40.590 ms/op 35.514 ms/op 1.14
altair processBlock - 250000 vs - 7PWei worstcase 40.490 ms/op 45.743 ms/op 0.89
altair processBlock - 250000 vs - 7PWei worstcase hashState 103.38 ms/op 102.27 ms/op 1.01
phase0 processBlock - 250000 vs - 7PWei normalcase 2.9217 ms/op 2.9177 ms/op 1.00
phase0 processBlock - 250000 vs - 7PWei worstcase 33.510 ms/op 31.999 ms/op 1.05
altair processEth1Data - 250000 vs - 7PWei normalcase 715.54 us/op 584.65 us/op 1.22
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 15.518 us/op 13.991 us/op 1.11
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 47.927 us/op 75.645 us/op 0.63
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.978 us/op 35.764 us/op 0.56
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 11.441 us/op 12.771 us/op 0.90
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 221.97 us/op 191.33 us/op 1.16
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3298 ms/op 1.4062 ms/op 0.95
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.1592 ms/op 1.7804 ms/op 1.21
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7871 ms/op 2.0526 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.6227 ms/op 4.4584 ms/op 1.04
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.7982 ms/op 2.7254 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.9494 ms/op 5.6375 ms/op 1.23
Tree 40 250000 create 461.37 ms/op 366.95 ms/op 1.26
Tree 40 250000 get(125000) 224.76 ns/op 218.71 ns/op 1.03
Tree 40 250000 set(125000) 1.2343 us/op 1.1221 us/op 1.10
Tree 40 250000 toArray() 24.521 ms/op 23.271 ms/op 1.05
Tree 40 250000 iterate all - toArray() + loop 24.788 ms/op 23.684 ms/op 1.05
Tree 40 250000 iterate all - get(i) 78.094 ms/op 73.424 ms/op 1.06
MutableVector 250000 create 17.429 ms/op 14.794 ms/op 1.18
MutableVector 250000 get(125000) 6.6850 ns/op 7.0400 ns/op 0.95
MutableVector 250000 set(125000) 323.52 ns/op 296.40 ns/op 1.09
MutableVector 250000 toArray() 4.1500 ms/op 3.8275 ms/op 1.08
MutableVector 250000 iterate all - toArray() + loop 4.2264 ms/op 3.7158 ms/op 1.14
MutableVector 250000 iterate all - get(i) 1.5815 ms/op 1.5600 ms/op 1.01
Array 250000 create 3.9341 ms/op 3.7376 ms/op 1.05
Array 250000 clone - spread 1.5318 ms/op 1.4291 ms/op 1.07
Array 250000 get(125000) 1.2400 ns/op 1.1660 ns/op 1.06
Array 250000 set(125000) 5.6250 ns/op 4.3190 ns/op 1.30
Array 250000 iterate all - loop 172.19 us/op 175.28 us/op 0.98
effectiveBalanceIncrements clone Uint8Array 300000 53.338 us/op 46.337 us/op 1.15
effectiveBalanceIncrements clone MutableVector 300000 475.00 ns/op 454.00 ns/op 1.05
effectiveBalanceIncrements rw all Uint8Array 300000 213.41 us/op 210.25 us/op 1.02
effectiveBalanceIncrements rw all MutableVector 300000 101.63 ms/op 115.30 ms/op 0.88
phase0 afterProcessEpoch - 250000 vs - 7PWei 121.59 ms/op 119.06 ms/op 1.02
phase0 beforeProcessEpoch - 250000 vs - 7PWei 63.748 ms/op 59.314 ms/op 1.07
altair processEpoch - mainnet_e81889 553.09 ms/op 554.34 ms/op 1.00
mainnet_e81889 - altair beforeProcessEpoch 102.35 ms/op 102.27 ms/op 1.00
mainnet_e81889 - altair processJustificationAndFinalization 23.775 us/op 21.833 us/op 1.09
mainnet_e81889 - altair processInactivityUpdates 8.4010 ms/op 6.1338 ms/op 1.37
mainnet_e81889 - altair processRewardsAndPenalties 64.804 ms/op 69.568 ms/op 0.93
mainnet_e81889 - altair processRegistryUpdates 5.2050 us/op 3.2060 us/op 1.62
mainnet_e81889 - altair processSlashings 1.4660 us/op 670.00 ns/op 2.19
mainnet_e81889 - altair processEth1DataReset 602.00 ns/op 661.00 ns/op 0.91
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5074 ms/op 1.7796 ms/op 0.85
mainnet_e81889 - altair processSlashingsReset 5.0190 us/op 4.0230 us/op 1.25
mainnet_e81889 - altair processRandaoMixesReset 9.0970 us/op 6.5930 us/op 1.38
mainnet_e81889 - altair processHistoricalRootsUpdate 1.5690 us/op 1.1530 us/op 1.36
mainnet_e81889 - altair processParticipationFlagUpdates 2.5400 us/op 1.9060 us/op 1.33
mainnet_e81889 - altair processSyncCommitteeUpdates 2.1150 us/op 1.8280 us/op 1.16
mainnet_e81889 - altair afterProcessEpoch 138.69 ms/op 127.66 ms/op 1.09
capella processEpoch - mainnet_e217614 2.6156 s/op 2.7998 s/op 0.93
mainnet_e217614 - capella beforeProcessEpoch 564.67 ms/op 554.21 ms/op 1.02
mainnet_e217614 - capella processJustificationAndFinalization 19.642 us/op 18.010 us/op 1.09
mainnet_e217614 - capella processInactivityUpdates 22.026 ms/op 23.638 ms/op 0.93
mainnet_e217614 - capella processRewardsAndPenalties 457.75 ms/op 471.74 ms/op 0.97
mainnet_e217614 - capella processRegistryUpdates 43.015 us/op 28.836 us/op 1.49
mainnet_e217614 - capella processSlashings 1.1940 us/op 809.00 ns/op 1.48
mainnet_e217614 - capella processEth1DataReset 1.2870 us/op 682.00 ns/op 1.89
mainnet_e217614 - capella processEffectiveBalanceUpdates 11.751 ms/op 5.9825 ms/op 1.96
mainnet_e217614 - capella processSlashingsReset 6.6210 us/op 4.0040 us/op 1.65
mainnet_e217614 - capella processRandaoMixesReset 13.274 us/op 6.3290 us/op 2.10
mainnet_e217614 - capella processHistoricalRootsUpdate 2.2900 us/op 713.00 ns/op 3.21
mainnet_e217614 - capella processParticipationFlagUpdates 3.3290 us/op 2.5520 us/op 1.30
mainnet_e217614 - capella afterProcessEpoch 441.79 ms/op 322.83 ms/op 1.37
phase0 processEpoch - mainnet_e58758 826.83 ms/op 474.03 ms/op 1.74
mainnet_e58758 - phase0 beforeProcessEpoch 239.48 ms/op 160.26 ms/op 1.49
mainnet_e58758 - phase0 processJustificationAndFinalization 44.241 us/op 21.771 us/op 2.03
mainnet_e58758 - phase0 processRewardsAndPenalties 82.926 ms/op 57.036 ms/op 1.45
mainnet_e58758 - phase0 processRegistryUpdates 19.781 us/op 14.251 us/op 1.39
mainnet_e58758 - phase0 processSlashings 1.8480 us/op 555.00 ns/op 3.33
mainnet_e58758 - phase0 processEth1DataReset 969.00 ns/op 699.00 ns/op 1.39
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.5989 ms/op 1.6091 ms/op 0.99
mainnet_e58758 - phase0 processSlashingsReset 6.9770 us/op 3.3130 us/op 2.11
mainnet_e58758 - phase0 processRandaoMixesReset 14.846 us/op 5.4720 us/op 2.71
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.5400 us/op 436.00 ns/op 3.53
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.8210 us/op 4.0820 us/op 2.16
mainnet_e58758 - phase0 afterProcessEpoch 115.46 ms/op 97.623 ms/op 1.18
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.7481 ms/op 1.4386 ms/op 1.91
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4361 ms/op 1.9660 ms/op 1.24
altair processInactivityUpdates - 250000 normalcase 45.967 ms/op 30.365 ms/op 1.51
altair processInactivityUpdates - 250000 worstcase 55.967 ms/op 25.117 ms/op 2.23
phase0 processRegistryUpdates - 250000 normalcase 20.576 us/op 11.459 us/op 1.80
phase0 processRegistryUpdates - 250000 badcase_full_deposits 553.25 us/op 757.55 us/op 0.73
phase0 processRegistryUpdates - 250000 worstcase 0.5 217.34 ms/op 131.85 ms/op 1.65
altair processRewardsAndPenalties - 250000 normalcase 76.331 ms/op 62.347 ms/op 1.22
altair processRewardsAndPenalties - 250000 worstcase 70.286 ms/op 55.388 ms/op 1.27
phase0 getAttestationDeltas - 250000 normalcase 14.351 ms/op 9.8583 ms/op 1.46
phase0 getAttestationDeltas - 250000 worstcase 12.241 ms/op 11.671 ms/op 1.05
phase0 processSlashings - 250000 worstcase 143.56 us/op 120.06 us/op 1.20
altair processSyncCommitteeUpdates - 250000 175.38 ms/op 169.18 ms/op 1.04
BeaconState.hashTreeRoot - No change 649.00 ns/op 461.00 ns/op 1.41
BeaconState.hashTreeRoot - 1 full validator 183.82 us/op 126.71 us/op 1.45
BeaconState.hashTreeRoot - 32 full validator 1.8822 ms/op 1.3308 ms/op 1.41
BeaconState.hashTreeRoot - 512 full validator 21.242 ms/op 21.931 ms/op 0.97
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 294.96 us/op 219.69 us/op 1.34
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.4987 ms/op 2.1282 ms/op 1.64
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 40.670 ms/op 28.349 ms/op 1.43
BeaconState.hashTreeRoot - 1 balances 178.67 us/op 142.97 us/op 1.25
BeaconState.hashTreeRoot - 32 balances 1.6176 ms/op 1.4945 ms/op 1.08
BeaconState.hashTreeRoot - 512 balances 17.538 ms/op 14.408 ms/op 1.22
BeaconState.hashTreeRoot - 250000 balances 374.70 ms/op 212.45 ms/op 1.76
aggregationBits - 2048 els - zipIndexesInBitList 49.500 us/op 20.081 us/op 2.47
byteArrayEquals 32 165.38 ns/op 81.011 ns/op 2.04
Buffer.compare 32 104.67 ns/op 57.855 ns/op 1.81
byteArrayEquals 1024 3.3376 us/op 2.3551 us/op 1.42
Buffer.compare 1024 93.899 ns/op 80.450 ns/op 1.17
byteArrayEquals 16384 50.969 us/op 37.273 us/op 1.37
Buffer.compare 16384 484.40 ns/op 281.78 ns/op 1.72
byteArrayEquals 123687377 323.35 ms/op 266.39 ms/op 1.21
Buffer.compare 123687377 10.145 ms/op 8.0518 ms/op 1.26
byteArrayEquals 32 - diff last byte 76.018 ns/op 84.478 ns/op 0.90
Buffer.compare 32 - diff last byte 67.283 ns/op 60.722 ns/op 1.11
byteArrayEquals 1024 - diff last byte 2.5346 us/op 2.1198 us/op 1.20
Buffer.compare 1024 - diff last byte 82.941 ns/op 75.149 ns/op 1.10
byteArrayEquals 16384 - diff last byte 35.279 us/op 34.258 us/op 1.03
Buffer.compare 16384 - diff last byte 288.01 ns/op 283.17 ns/op 1.02
byteArrayEquals 123687377 - diff last byte 258.26 ms/op 256.30 ms/op 1.01
Buffer.compare 123687377 - diff last byte 7.6849 ms/op 6.6865 ms/op 1.15
byteArrayEquals 32 - random bytes 5.5980 ns/op 5.4440 ns/op 1.03
Buffer.compare 32 - random bytes 70.387 ns/op 63.056 ns/op 1.12
byteArrayEquals 1024 - random bytes 5.6740 ns/op 5.4050 ns/op 1.05
Buffer.compare 1024 - random bytes 63.395 ns/op 62.213 ns/op 1.02
byteArrayEquals 16384 - random bytes 5.6630 ns/op 5.3970 ns/op 1.05
Buffer.compare 16384 - random bytes 63.527 ns/op 61.795 ns/op 1.03
byteArrayEquals 123687377 - random bytes 9.2800 ns/op 8.9500 ns/op 1.04
Buffer.compare 123687377 - random bytes 66.550 ns/op 66.270 ns/op 1.00
regular array get 100000 times 45.364 us/op 45.555 us/op 1.00
wrappedArray get 100000 times 45.478 us/op 45.738 us/op 0.99
arrayWithProxy get 100000 times 14.140 ms/op 14.470 ms/op 0.98
ssz.Root.equals 54.422 ns/op 55.826 ns/op 0.97
byteArrayEquals 53.601 ns/op 54.400 ns/op 0.99
Buffer.compare 11.131 ns/op 11.497 ns/op 0.97
shuffle list - 16384 els 7.0642 ms/op 7.0133 ms/op 1.01
shuffle list - 250000 els 104.56 ms/op 102.73 ms/op 1.02
processSlot - 1 slots 18.637 us/op 15.688 us/op 1.19
processSlot - 32 slots 3.6124 ms/op 3.0100 ms/op 1.20
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 62.733 ms/op 59.020 ms/op 1.06
getCommitteeAssignments - req 1 vs - 250000 vc 2.5387 ms/op 2.5861 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 3.7564 ms/op 3.7728 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 4.1501 ms/op 4.1600 ms/op 1.00
findModifiedValidators - 10000 modified validators 542.87 ms/op 556.18 ms/op 0.98
findModifiedValidators - 1000 modified validators 440.25 ms/op 439.29 ms/op 1.00
findModifiedValidators - 100 modified validators 455.30 ms/op 437.62 ms/op 1.04
findModifiedValidators - 10 modified validators 453.53 ms/op 431.84 ms/op 1.05
findModifiedValidators - 1 modified validators 425.85 ms/op 403.82 ms/op 1.05
findModifiedValidators - no difference 412.76 ms/op 417.90 ms/op 0.99
compare ViewDUs 5.0041 s/op 4.9680 s/op 1.01
compare each validator Uint8Array 2.1245 s/op 1.7215 s/op 1.23
compare ViewDU to Uint8Array 1.5118 s/op 1.3202 s/op 1.15
migrate state 1000000 validators, 24 modified, 0 new 919.98 ms/op 836.06 ms/op 1.10
migrate state 1000000 validators, 1700 modified, 1000 new 1.3131 s/op 1.2018 s/op 1.09
migrate state 1000000 validators, 3400 modified, 2000 new 1.7443 s/op 1.4794 s/op 1.18
migrate state 1500000 validators, 24 modified, 0 new 1.1604 s/op 887.66 ms/op 1.31
migrate state 1500000 validators, 1700 modified, 1000 new 1.3504 s/op 1.2396 s/op 1.09
migrate state 1500000 validators, 3400 modified, 2000 new 1.6054 s/op 1.4686 s/op 1.09
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.4700 ns/op 4.9800 ns/op 1.10
state getBlockRootAtSlot - 250000 vs - 7PWei 855.46 ns/op 663.60 ns/op 1.29
computeProposers - vc 250000 10.795 ms/op 9.7328 ms/op 1.11
computeEpochShuffling - vc 250000 113.67 ms/op 110.61 ms/op 1.03
getNextSyncCommittee - vc 250000 177.43 ms/op 177.89 ms/op 1.00
computeSigningRoot for AttestationData 35.042 us/op 34.397 us/op 1.02
hash AttestationData serialized data then Buffer.toString(base64) 2.5317 us/op 2.4392 us/op 1.04
toHexString serialized data 1.8987 us/op 1.1957 us/op 1.59
Buffer.toString(base64) 294.06 ns/op 247.77 ns/op 1.19

by benchmarkbot/action

if (this.blsPoolType === BlsPoolType.workers) {
await this.runJobWorkerPool(prepared);
} else {
await this.runJobLibuv(prepared);
Copy link
Contributor

Choose a reason for hiding this comment

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

if possible I'd like to refactor the current implementation to have BaseBlsMultiThreadPool to move all common code there, have BlsMultiThreadWorkerPool for worker specific implementation, and have this new work in another implementation, so there would be multiple steps required to make this happens similar to n_historical_states work I've worked on

that would make a smooth transition to new bls implementation, it's also easier to review and maintain. What's your opinions on this approach @matthewkeil @wemeetagain ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I can take a look at this in the updated PR #6362 once the metrics look good. Going to try and limit the complexity until I can get it running smoothly though @tuyennhv

@twoeths
Copy link
Contributor

twoeths commented Jan 26, 2024

the test mainnet node does not look great in the last 6h, may worth to look into this @matthewkeil

Screenshot 2024-01-26 at 20 20 20

vs unstable

Screenshot 2024-01-26 at 20 21 57

@matthewkeil
Copy link
Member Author

Closing this in favor of #6362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants