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

chore: refactor chain event emits #6993

Merged
merged 2 commits into from
Aug 2, 2024
Merged

Conversation

wemeetagain
Copy link
Member

@wemeetagain wemeetagain commented Jul 31, 2024

Motivation

  • small thing noticed when looking thru the code

Description

  • move event emitting of block and blob sidecar events to the place in code where the rest are emitted
  • move blob source metrics with other metrics
  • wrap all chain event emits in a callOnNextEventLoop

@wemeetagain wemeetagain requested a review from a team as a code owner July 31, 2024 20:56
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.49%. Comparing base (42af692) to head (7cd8b56).
Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6993      +/-   ##
============================================
- Coverage     62.49%   62.49%   -0.01%     
============================================
  Files           576      576              
  Lines         61199    61198       -1     
  Branches       2141     2132       -9     
============================================
- Hits          38246    38243       -3     
- Misses        22914    22916       +2     
  Partials         39       39              

Copy link
Contributor

github-actions bot commented Jul 31, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 6113dce Previous: 42af692 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.1482 ms/op 2.3474 ms/op 0.92
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 40.584 us/op 52.393 us/op 0.77
BLS verify - blst 898.11 us/op 1.4026 ms/op 0.64
BLS verifyMultipleSignatures 3 - blst 1.2919 ms/op 1.5308 ms/op 0.84
BLS verifyMultipleSignatures 8 - blst 2.1284 ms/op 2.0324 ms/op 1.05
BLS verifyMultipleSignatures 32 - blst 4.7212 ms/op 6.7691 ms/op 0.70
BLS verifyMultipleSignatures 64 - blst 8.6587 ms/op 12.422 ms/op 0.70
BLS verifyMultipleSignatures 128 - blst 16.412 ms/op 20.296 ms/op 0.81
BLS deserializing 10000 signatures 637.67 ms/op 749.93 ms/op 0.85
BLS deserializing 100000 signatures 6.4445 s/op 7.0843 s/op 0.91
BLS verifyMultipleSignatures - same message - 3 - blst 973.87 us/op 921.74 us/op 1.06
BLS verifyMultipleSignatures - same message - 8 - blst 1.1219 ms/op 1.1458 ms/op 0.98
BLS verifyMultipleSignatures - same message - 32 - blst 1.6925 ms/op 1.8242 ms/op 0.93
BLS verifyMultipleSignatures - same message - 64 - blst 2.5858 ms/op 2.5115 ms/op 1.03
BLS verifyMultipleSignatures - same message - 128 - blst 4.2275 ms/op 4.2574 ms/op 0.99
BLS aggregatePubkeys 32 - blst 18.421 us/op 21.077 us/op 0.87
BLS aggregatePubkeys 128 - blst 64.988 us/op 71.386 us/op 0.91
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 70.998 ms/op 84.149 ms/op 0.84
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 48.927 ms/op 71.233 ms/op 0.69
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 29.938 ms/op 50.245 ms/op 0.60
getSlashingsAndExits - default max 80.062 us/op 105.10 us/op 0.76
getSlashingsAndExits - 2k 266.46 us/op 363.07 us/op 0.73
proposeBlockBody type=full, size=empty 5.1220 ms/op 7.5239 ms/op 0.68
isKnown best case - 1 super set check 484.00 ns/op 586.00 ns/op 0.83
isKnown normal case - 2 super set checks 474.00 ns/op 609.00 ns/op 0.78
isKnown worse case - 16 super set checks 464.00 ns/op 607.00 ns/op 0.76
InMemoryCheckpointStateCache - add get delete 4.3390 us/op 6.5280 us/op 0.66
validate api signedAggregateAndProof - struct 1.6628 ms/op 1.9668 ms/op 0.85
validate gossip signedAggregateAndProof - struct 1.8838 ms/op 1.6802 ms/op 1.12
validate gossip attestation - vc 640000 978.53 us/op 1.1373 ms/op 0.86
batch validate gossip attestation - vc 640000 - chunk 32 127.45 us/op 140.42 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 64 116.19 us/op 120.91 us/op 0.96
batch validate gossip attestation - vc 640000 - chunk 128 110.66 us/op 111.35 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 256 104.04 us/op 107.65 us/op 0.97
pickEth1Vote - no votes 969.32 us/op 1.0206 ms/op 0.95
pickEth1Vote - max votes 6.5759 ms/op 8.3656 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.336 ms/op 11.973 ms/op 0.86
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 16.961 ms/op 19.490 ms/op 0.87
pickEth1Vote - Eth1Data fastSerialize value x2048 379.21 us/op 480.36 us/op 0.79
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.9188 ms/op 3.6932 ms/op 1.60
bytes32 toHexString 874.00 ns/op 450.00 ns/op 1.94
bytes32 Buffer.toString(hex) 515.00 ns/op 278.00 ns/op 1.85
bytes32 Buffer.toString(hex) from Uint8Array 713.00 ns/op 461.00 ns/op 1.55
bytes32 Buffer.toString(hex) + 0x 489.00 ns/op 270.00 ns/op 1.81
Object access 1 prop 0.40600 ns/op 0.15300 ns/op 2.65
Map access 1 prop 0.34400 ns/op 0.14200 ns/op 2.42
Object get x1000 5.1490 ns/op 6.1230 ns/op 0.84
Map get x1000 5.7960 ns/op 6.7250 ns/op 0.86
Object set x1000 37.813 ns/op 33.281 ns/op 1.14
Map set x1000 33.642 ns/op 24.796 ns/op 1.36
Return object 10000 times 0.31050 ns/op 0.29410 ns/op 1.06
Throw Error 10000 times 2.7737 us/op 3.5235 us/op 0.79
fastMsgIdFn sha256 / 200 bytes 2.1110 us/op 2.2180 us/op 0.95
fastMsgIdFn h32 xxhash / 200 bytes 499.00 ns/op 231.00 ns/op 2.16
fastMsgIdFn h64 xxhash / 200 bytes 490.00 ns/op 270.00 ns/op 1.81
fastMsgIdFn sha256 / 1000 bytes 6.5760 us/op 7.4190 us/op 0.89
fastMsgIdFn h32 xxhash / 1000 bytes 653.00 ns/op 375.00 ns/op 1.74
fastMsgIdFn h64 xxhash / 1000 bytes 602.00 ns/op 350.00 ns/op 1.72
fastMsgIdFn sha256 / 10000 bytes 55.629 us/op 65.725 us/op 0.85
fastMsgIdFn h32 xxhash / 10000 bytes 2.1130 us/op 1.9500 us/op 1.08
fastMsgIdFn h64 xxhash / 10000 bytes 1.4270 us/op 1.2630 us/op 1.13
send data - 1000 256B messages 14.658 ms/op 13.206 ms/op 1.11
send data - 1000 512B messages 21.029 ms/op 17.560 ms/op 1.20
send data - 1000 1024B messages 25.563 ms/op 25.543 ms/op 1.00
send data - 1000 1200B messages 30.599 ms/op 27.962 ms/op 1.09
send data - 1000 2048B messages 33.304 ms/op 34.855 ms/op 0.96
send data - 1000 4096B messages 27.803 ms/op 32.248 ms/op 0.86
send data - 1000 16384B messages 65.559 ms/op 72.367 ms/op 0.91
send data - 1000 65536B messages 253.77 ms/op 216.48 ms/op 1.17
enrSubnets - fastDeserialize 64 bits 1.1450 us/op 1.4690 us/op 0.78
enrSubnets - ssz BitVector 64 bits 518.00 ns/op 455.00 ns/op 1.14
enrSubnets - fastDeserialize 4 bits 325.00 ns/op 180.00 ns/op 1.81
enrSubnets - ssz BitVector 4 bits 515.00 ns/op 409.00 ns/op 1.26
prioritizePeers score -10:0 att 32-0.1 sync 2-0 135.54 us/op 176.11 us/op 0.77
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 133.82 us/op 187.72 us/op 0.71
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 352.04 us/op 258.82 us/op 1.36
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 466.97 us/op 494.98 us/op 0.94
prioritizePeers score 0:0 att 64-1 sync 4-1 504.10 us/op 793.66 us/op 0.64
array of 16000 items push then shift 1.3553 us/op 1.7206 us/op 0.79
LinkedList of 16000 items push then shift 6.8230 ns/op 7.4030 ns/op 0.92
array of 16000 items push then pop 122.41 ns/op 131.91 ns/op 0.93
LinkedList of 16000 items push then pop 7.0240 ns/op 7.5000 ns/op 0.94
array of 24000 items push then shift 1.9224 us/op 2.5220 us/op 0.76
LinkedList of 24000 items push then shift 7.5360 ns/op 7.6280 ns/op 0.99
array of 24000 items push then pop 196.78 ns/op 178.35 ns/op 1.10
LinkedList of 24000 items push then pop 6.5990 ns/op 7.3390 ns/op 0.90
intersect bitArray bitLen 8 5.4090 ns/op 6.6670 ns/op 0.81
intersect array and set length 8 41.409 ns/op 47.851 ns/op 0.87
intersect bitArray bitLen 128 25.695 ns/op 31.102 ns/op 0.83
intersect array and set length 128 635.03 ns/op 702.80 ns/op 0.90
bitArray.getTrueBitIndexes() bitLen 128 2.4140 us/op 2.2080 us/op 1.09
bitArray.getTrueBitIndexes() bitLen 248 3.2250 us/op 3.4250 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 512 8.0470 us/op 8.5160 us/op 0.94
Buffer.concat 32 items 1.1530 us/op 1.0130 us/op 1.14
Uint8Array.set 32 items 1.7100 us/op 1.7080 us/op 1.00
Buffer.copy 2.1270 us/op 1.8120 us/op 1.17
Uint8Array.set - with subarray 2.9750 us/op 2.8390 us/op 1.05
Uint8Array.set - without subarray 1.5900 us/op 1.7890 us/op 0.89
getUint32 - dataview 435.00 ns/op 260.00 ns/op 1.67
getUint32 - manual 370.00 ns/op 174.00 ns/op 2.13
Set add up to 64 items then delete first 1.8166 us/op 2.2585 us/op 0.80
OrderedSet add up to 64 items then delete first 2.8439 us/op 3.3780 us/op 0.84
Set add up to 64 items then delete last 2.0514 us/op 2.6557 us/op 0.77
OrderedSet add up to 64 items then delete last 3.0898 us/op 4.0242 us/op 0.77
Set add up to 64 items then delete middle 2.0449 us/op 2.6208 us/op 0.78
OrderedSet add up to 64 items then delete middle 4.5578 us/op 5.3505 us/op 0.85
Set add up to 128 items then delete first 4.0558 us/op 5.1427 us/op 0.79
OrderedSet add up to 128 items then delete first 6.4826 us/op 7.5641 us/op 0.86
Set add up to 128 items then delete last 3.9725 us/op 5.1160 us/op 0.78
OrderedSet add up to 128 items then delete last 6.0225 us/op 7.8330 us/op 0.77
Set add up to 128 items then delete middle 3.9100 us/op 4.9549 us/op 0.79
OrderedSet add up to 128 items then delete middle 11.812 us/op 14.612 us/op 0.81
Set add up to 256 items then delete first 8.0668 us/op 10.657 us/op 0.76
OrderedSet add up to 256 items then delete first 12.809 us/op 15.474 us/op 0.83
Set add up to 256 items then delete last 7.7494 us/op 10.441 us/op 0.74
OrderedSet add up to 256 items then delete last 11.982 us/op 15.717 us/op 0.76
Set add up to 256 items then delete middle 7.7946 us/op 10.249 us/op 0.76
OrderedSet add up to 256 items then delete middle 35.349 us/op 41.804 us/op 0.85
transfer serialized Status (84 B) 1.4300 us/op 1.5330 us/op 0.93
copy serialized Status (84 B) 1.2590 us/op 1.3220 us/op 0.95
transfer serialized SignedVoluntaryExit (112 B) 1.4840 us/op 1.5100 us/op 0.98
copy serialized SignedVoluntaryExit (112 B) 1.2760 us/op 1.2190 us/op 1.05
transfer serialized ProposerSlashing (416 B) 1.6060 us/op 1.5850 us/op 1.01
copy serialized ProposerSlashing (416 B) 1.4910 us/op 1.7910 us/op 0.83
transfer serialized Attestation (485 B) 1.6400 us/op 2.3080 us/op 0.71
copy serialized Attestation (485 B) 1.6810 us/op 2.0910 us/op 0.80
transfer serialized AttesterSlashing (33232 B) 1.6300 us/op 1.7820 us/op 0.91
copy serialized AttesterSlashing (33232 B) 4.3170 us/op 6.6230 us/op 0.65
transfer serialized Small SignedBeaconBlock (128000 B) 2.3120 us/op 2.5700 us/op 0.90
copy serialized Small SignedBeaconBlock (128000 B) 10.577 us/op 20.669 us/op 0.51
transfer serialized Avg SignedBeaconBlock (200000 B) 3.0640 us/op 3.2230 us/op 0.95
copy serialized Avg SignedBeaconBlock (200000 B) 15.283 us/op 27.794 us/op 0.55
transfer serialized BlobsSidecar (524380 B) 3.5790 us/op 3.3450 us/op 1.07
copy serialized BlobsSidecar (524380 B) 74.223 us/op 82.259 us/op 0.90
transfer serialized Big SignedBeaconBlock (1000000 B) 4.1100 us/op 3.3280 us/op 1.23
copy serialized Big SignedBeaconBlock (1000000 B) 383.72 us/op 174.34 us/op 2.20
pass gossip attestations to forkchoice per slot 3.1459 ms/op 3.4646 ms/op 0.91
forkChoice updateHead vc 100000 bc 64 eq 0 433.25 us/op 653.93 us/op 0.66
forkChoice updateHead vc 600000 bc 64 eq 0 2.8719 ms/op 3.7951 ms/op 0.76
forkChoice updateHead vc 1000000 bc 64 eq 0 4.2344 ms/op 6.5293 ms/op 0.65
forkChoice updateHead vc 600000 bc 320 eq 0 2.5141 ms/op 3.3919 ms/op 0.74
forkChoice updateHead vc 600000 bc 1200 eq 0 2.7778 ms/op 3.3556 ms/op 0.83
forkChoice updateHead vc 600000 bc 7200 eq 0 3.1066 ms/op 5.1566 ms/op 0.60
forkChoice updateHead vc 600000 bc 64 eq 1000 10.682 ms/op 11.756 ms/op 0.91
forkChoice updateHead vc 600000 bc 64 eq 10000 9.8628 ms/op 12.740 ms/op 0.77
forkChoice updateHead vc 600000 bc 64 eq 300000 16.705 ms/op 16.545 ms/op 1.01
computeDeltas 500000 validators 300 proto nodes 3.2443 ms/op 4.1842 ms/op 0.78
computeDeltas 500000 validators 1200 proto nodes 3.2245 ms/op 4.3095 ms/op 0.75
computeDeltas 500000 validators 7200 proto nodes 3.2195 ms/op 4.0806 ms/op 0.79
computeDeltas 750000 validators 300 proto nodes 4.8687 ms/op 5.7188 ms/op 0.85
computeDeltas 750000 validators 1200 proto nodes 4.6862 ms/op 5.8281 ms/op 0.80
computeDeltas 750000 validators 7200 proto nodes 4.6973 ms/op 6.2052 ms/op 0.76
computeDeltas 1400000 validators 300 proto nodes 8.9196 ms/op 11.131 ms/op 0.80
computeDeltas 1400000 validators 1200 proto nodes 8.7285 ms/op 11.489 ms/op 0.76
computeDeltas 1400000 validators 7200 proto nodes 8.4188 ms/op 11.110 ms/op 0.76
computeDeltas 2100000 validators 300 proto nodes 12.321 ms/op 17.446 ms/op 0.71
computeDeltas 2100000 validators 1200 proto nodes 12.634 ms/op 17.077 ms/op 0.74
computeDeltas 2100000 validators 7200 proto nodes 12.213 ms/op 17.686 ms/op 0.69
altair processAttestation - 250000 vs - 7PWei normalcase 1.4178 ms/op 2.2936 ms/op 0.62
altair processAttestation - 250000 vs - 7PWei worstcase 2.0736 ms/op 2.8880 ms/op 0.72
altair processAttestation - setStatus - 1/6 committees join 63.425 us/op 103.85 us/op 0.61
altair processAttestation - setStatus - 1/3 committees join 127.44 us/op 204.15 us/op 0.62
altair processAttestation - setStatus - 1/2 committees join 204.67 us/op 267.14 us/op 0.77
altair processAttestation - setStatus - 2/3 committees join 267.63 us/op 361.78 us/op 0.74
altair processAttestation - setStatus - 4/5 committees join 406.66 us/op 541.56 us/op 0.75
altair processAttestation - setStatus - 100% committees join 461.92 us/op 652.58 us/op 0.71
altair processBlock - 250000 vs - 7PWei normalcase 3.5685 ms/op 5.1057 ms/op 0.70
altair processBlock - 250000 vs - 7PWei normalcase hashState 22.589 ms/op 27.529 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase 35.514 ms/op 42.934 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase hashState 72.386 ms/op 80.152 ms/op 0.90
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0491 ms/op 2.9595 ms/op 0.69
phase0 processBlock - 250000 vs - 7PWei worstcase 25.071 ms/op 28.804 ms/op 0.87
altair processEth1Data - 250000 vs - 7PWei normalcase 258.22 us/op 330.27 us/op 0.78
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.1320 us/op 7.7840 us/op 0.66
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 18.151 us/op 23.250 us/op 0.78
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 7.6940 us/op 8.8200 us/op 0.87
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 5.1580 us/op 5.4020 us/op 0.95
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 80.635 us/op 122.47 us/op 0.66
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 761.42 us/op 709.91 us/op 1.07
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 611.68 us/op 1.2726 ms/op 0.48
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0484 ms/op 1.4731 ms/op 0.71
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 1.9660 ms/op 2.7460 ms/op 0.72
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.1251 ms/op 2.4570 ms/op 0.46
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.1652 ms/op 3.7750 ms/op 0.84
Tree 40 250000 create 183.18 ms/op 214.83 ms/op 0.85
Tree 40 250000 get(125000) 111.04 ns/op 147.35 ns/op 0.75
Tree 40 250000 set(125000) 532.08 ns/op 638.34 ns/op 0.83
Tree 40 250000 toArray() 9.8881 ms/op 17.340 ms/op 0.57
Tree 40 250000 iterate all - toArray() + loop 9.7023 ms/op 17.182 ms/op 0.56
Tree 40 250000 iterate all - get(i) 41.427 ms/op 52.504 ms/op 0.79
MutableVector 250000 create 10.049 ms/op 10.815 ms/op 0.93
MutableVector 250000 get(125000) 5.8150 ns/op 6.7790 ns/op 0.86
MutableVector 250000 set(125000) 174.78 ns/op 183.32 ns/op 0.95
MutableVector 250000 toArray() 2.7763 ms/op 3.3026 ms/op 0.84
MutableVector 250000 iterate all - toArray() + loop 2.9112 ms/op 3.4067 ms/op 0.85
MutableVector 250000 iterate all - get(i) 1.5644 ms/op 1.5456 ms/op 1.01
Array 250000 create 2.2758 ms/op 2.9065 ms/op 0.78
Array 250000 clone - spread 1.1845 ms/op 1.3177 ms/op 0.90
Array 250000 get(125000) 0.56900 ns/op 0.40500 ns/op 1.40
Array 250000 set(125000) 0.58000 ns/op 0.42900 ns/op 1.35
Array 250000 iterate all - loop 76.254 us/op 91.020 us/op 0.84
effectiveBalanceIncrements clone Uint8Array 300000 13.787 us/op 27.830 us/op 0.50
effectiveBalanceIncrements clone MutableVector 300000 309.00 ns/op 123.00 ns/op 2.51
effectiveBalanceIncrements rw all Uint8Array 300000 165.23 us/op 200.01 us/op 0.83
effectiveBalanceIncrements rw all MutableVector 300000 55.280 ms/op 60.339 ms/op 0.92
phase0 afterProcessEpoch - 250000 vs - 7PWei 75.681 ms/op 87.862 ms/op 0.86
Array.fill - length 1000000 2.4527 ms/op 3.4399 ms/op 0.71
Array push - length 1000000 14.608 ms/op 22.563 ms/op 0.65
Array.get 0.26675 ns/op 0.27748 ns/op 0.96
Uint8Array.get 0.33991 ns/op 0.43480 ns/op 0.78
phase0 beforeProcessEpoch - 250000 vs - 7PWei 17.471 ms/op 21.409 ms/op 0.82
altair processEpoch - mainnet_e81889 341.75 ms/op 348.30 ms/op 0.98
mainnet_e81889 - altair beforeProcessEpoch 29.343 ms/op 28.934 ms/op 1.01
mainnet_e81889 - altair processJustificationAndFinalization 9.2420 us/op 17.214 us/op 0.54
mainnet_e81889 - altair processInactivityUpdates 4.1533 ms/op 6.2904 ms/op 0.66
mainnet_e81889 - altair processRewardsAndPenalties 47.653 ms/op 57.680 ms/op 0.83
mainnet_e81889 - altair processRegistryUpdates 2.1640 us/op 2.8890 us/op 0.75
mainnet_e81889 - altair processSlashings 821.00 ns/op 605.00 ns/op 1.36
mainnet_e81889 - altair processEth1DataReset 692.00 ns/op 445.00 ns/op 1.56
mainnet_e81889 - altair processEffectiveBalanceUpdates 857.70 us/op 2.5017 ms/op 0.34
mainnet_e81889 - altair processSlashingsReset 2.1520 us/op 4.6780 us/op 0.46
mainnet_e81889 - altair processRandaoMixesReset 3.8010 us/op 5.3970 us/op 0.70
mainnet_e81889 - altair processHistoricalRootsUpdate 751.00 ns/op 478.00 ns/op 1.57
mainnet_e81889 - altair processParticipationFlagUpdates 1.8050 us/op 2.5520 us/op 0.71
mainnet_e81889 - altair processSyncCommitteeUpdates 884.00 ns/op 499.00 ns/op 1.77
mainnet_e81889 - altair afterProcessEpoch 80.900 ms/op 95.986 ms/op 0.84
capella processEpoch - mainnet_e217614 1.3621 s/op 1.4730 s/op 0.92
mainnet_e217614 - capella beforeProcessEpoch 117.71 ms/op 112.29 ms/op 1.05
mainnet_e217614 - capella processJustificationAndFinalization 21.150 us/op 20.552 us/op 1.03
mainnet_e217614 - capella processInactivityUpdates 16.959 ms/op 18.781 ms/op 0.90
mainnet_e217614 - capella processRewardsAndPenalties 274.27 ms/op 264.17 ms/op 1.04
mainnet_e217614 - capella processRegistryUpdates 16.146 us/op 14.085 us/op 1.15
mainnet_e217614 - capella processSlashings 1.0980 us/op 491.00 ns/op 2.24
mainnet_e217614 - capella processEth1DataReset 795.00 ns/op 481.00 ns/op 1.65
mainnet_e217614 - capella processEffectiveBalanceUpdates 12.751 ms/op 8.2658 ms/op 1.54
mainnet_e217614 - capella processSlashingsReset 3.7870 us/op 4.9260 us/op 0.77
mainnet_e217614 - capella processRandaoMixesReset 6.5310 us/op 11.316 us/op 0.58
mainnet_e217614 - capella processHistoricalRootsUpdate 834.00 ns/op 1.0190 us/op 0.82
mainnet_e217614 - capella processParticipationFlagUpdates 4.4920 us/op 2.7090 us/op 1.66
mainnet_e217614 - capella afterProcessEpoch 234.64 ms/op 308.00 ms/op 0.76
phase0 processEpoch - mainnet_e58758 441.31 ms/op 507.08 ms/op 0.87
mainnet_e58758 - phase0 beforeProcessEpoch 80.565 ms/op 119.40 ms/op 0.67
mainnet_e58758 - phase0 processJustificationAndFinalization 22.743 us/op 36.265 us/op 0.63
mainnet_e58758 - phase0 processRewardsAndPenalties 29.632 ms/op 37.605 ms/op 0.79
mainnet_e58758 - phase0 processRegistryUpdates 10.316 us/op 12.849 us/op 0.80
mainnet_e58758 - phase0 processSlashings 743.00 ns/op 603.00 ns/op 1.23
mainnet_e58758 - phase0 processEth1DataReset 770.00 ns/op 556.00 ns/op 1.38
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 695.13 us/op 1.4158 ms/op 0.49
mainnet_e58758 - phase0 processSlashingsReset 4.3530 us/op 3.5340 us/op 1.23
mainnet_e58758 - phase0 processRandaoMixesReset 4.9660 us/op 4.0600 us/op 1.22
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0780 us/op 354.00 ns/op 3.05
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.2340 us/op 4.2150 us/op 1.00
mainnet_e58758 - phase0 afterProcessEpoch 71.791 ms/op 88.266 ms/op 0.81
phase0 processEffectiveBalanceUpdates - 250000 normalcase 885.15 us/op 1.5230 ms/op 0.58
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.1540 ms/op 2.1332 ms/op 1.01
altair processInactivityUpdates - 250000 normalcase 18.457 ms/op 19.576 ms/op 0.94
altair processInactivityUpdates - 250000 worstcase 19.185 ms/op 18.901 ms/op 1.01
phase0 processRegistryUpdates - 250000 normalcase 7.1100 us/op 9.1320 us/op 0.78
phase0 processRegistryUpdates - 250000 badcase_full_deposits 308.24 us/op 364.18 us/op 0.85
phase0 processRegistryUpdates - 250000 worstcase 0.5 123.85 ms/op 124.43 ms/op 1.00
altair processRewardsAndPenalties - 250000 normalcase 38.429 ms/op 43.576 ms/op 0.88
altair processRewardsAndPenalties - 250000 worstcase 44.017 ms/op 47.142 ms/op 0.93
phase0 getAttestationDeltas - 250000 normalcase 6.6680 ms/op 7.8769 ms/op 0.85
phase0 getAttestationDeltas - 250000 worstcase 6.2672 ms/op 8.3871 ms/op 0.75
phase0 processSlashings - 250000 worstcase 90.615 us/op 93.215 us/op 0.97
altair processSyncCommitteeUpdates - 250000 92.060 ms/op 131.57 ms/op 0.70
BeaconState.hashTreeRoot - No change 500.00 ns/op 332.00 ns/op 1.51
BeaconState.hashTreeRoot - 1 full validator 77.270 us/op 103.93 us/op 0.74
BeaconState.hashTreeRoot - 32 full validator 871.56 us/op 857.84 us/op 1.02
BeaconState.hashTreeRoot - 512 full validator 8.9526 ms/op 8.7488 ms/op 1.02
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 133.02 us/op 115.89 us/op 1.15
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.0260 ms/op 1.3540 ms/op 1.50
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 26.466 ms/op 19.410 ms/op 1.36
BeaconState.hashTreeRoot - 1 balances 127.81 us/op 78.070 us/op 1.64
BeaconState.hashTreeRoot - 32 balances 1.2978 ms/op 772.92 us/op 1.68
BeaconState.hashTreeRoot - 512 balances 11.196 ms/op 7.0051 ms/op 1.60
BeaconState.hashTreeRoot - 250000 balances 169.09 ms/op 153.60 ms/op 1.10
aggregationBits - 2048 els - zipIndexesInBitList 20.337 us/op 24.118 us/op 0.84
byteArrayEquals 32 47.301 ns/op 53.843 ns/op 0.88
Buffer.compare 32 15.596 ns/op 17.783 ns/op 0.88
byteArrayEquals 1024 1.2780 us/op 1.6095 us/op 0.79
Buffer.compare 1024 23.736 ns/op 25.188 ns/op 0.94
byteArrayEquals 16384 20.208 us/op 25.302 us/op 0.80
Buffer.compare 16384 212.89 ns/op 202.24 ns/op 1.05
byteArrayEquals 123687377 153.51 ms/op 203.49 ms/op 0.75
Buffer.compare 123687377 6.1495 ms/op 7.0894 ms/op 0.87
byteArrayEquals 32 - diff last byte 45.698 ns/op 53.647 ns/op 0.85
Buffer.compare 32 - diff last byte 15.267 ns/op 17.545 ns/op 0.87
byteArrayEquals 1024 - diff last byte 1.2959 us/op 1.6195 us/op 0.80
Buffer.compare 1024 - diff last byte 25.683 ns/op 25.946 ns/op 0.99
byteArrayEquals 16384 - diff last byte 20.165 us/op 25.722 us/op 0.78
Buffer.compare 16384 - diff last byte 207.50 ns/op 206.06 ns/op 1.01
byteArrayEquals 123687377 - diff last byte 151.52 ms/op 196.43 ms/op 0.77
Buffer.compare 123687377 - diff last byte 5.4010 ms/op 7.4230 ms/op 0.73
byteArrayEquals 32 - random bytes 5.0000 ns/op 5.5130 ns/op 0.91
Buffer.compare 32 - random bytes 16.253 ns/op 18.080 ns/op 0.90
byteArrayEquals 1024 - random bytes 5.0320 ns/op 5.3980 ns/op 0.93
Buffer.compare 1024 - random bytes 15.794 ns/op 18.013 ns/op 0.88
byteArrayEquals 16384 - random bytes 5.0250 ns/op 5.4160 ns/op 0.93
Buffer.compare 16384 - random bytes 15.801 ns/op 18.156 ns/op 0.87
byteArrayEquals 123687377 - random bytes 7.9100 ns/op 6.8600 ns/op 1.15
Buffer.compare 123687377 - random bytes 18.840 ns/op 19.150 ns/op 0.98
regular array get 100000 times 31.321 us/op 45.311 us/op 0.69
wrappedArray get 100000 times 31.204 us/op 39.131 us/op 0.80
arrayWithProxy get 100000 times 9.8700 ms/op 14.139 ms/op 0.70
ssz.Root.equals 45.214 ns/op 47.853 ns/op 0.94
byteArrayEquals 42.672 ns/op 47.223 ns/op 0.90
Buffer.compare 9.1810 ns/op 10.840 ns/op 0.85
shuffle list - 16384 els 5.7722 ms/op 6.3639 ms/op 0.91
shuffle list - 250000 els 84.036 ms/op 97.067 ms/op 0.87
processSlot - 1 slots 10.366 us/op 14.296 us/op 0.73
processSlot - 32 slots 1.9542 ms/op 2.8610 ms/op 0.68
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.968 ms/op 38.787 ms/op 1.00
getCommitteeAssignments - req 1 vs - 250000 vc 1.7480 ms/op 2.1821 ms/op 0.80
getCommitteeAssignments - req 100 vs - 250000 vc 3.4611 ms/op 4.3019 ms/op 0.80
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7381 ms/op 4.7134 ms/op 0.79
findModifiedValidators - 10000 modified validators 221.42 ms/op 302.26 ms/op 0.73
findModifiedValidators - 1000 modified validators 140.66 ms/op 204.60 ms/op 0.69
findModifiedValidators - 100 modified validators 133.79 ms/op 204.92 ms/op 0.65
findModifiedValidators - 10 modified validators 143.50 ms/op 182.10 ms/op 0.79
findModifiedValidators - 1 modified validators 138.12 ms/op 169.47 ms/op 0.82
findModifiedValidators - no difference 140.36 ms/op 208.92 ms/op 0.67
compare ViewDUs 3.6224 s/op 3.6014 s/op 1.01
compare each validator Uint8Array 1.3240 s/op 1.2448 s/op 1.06
compare ViewDU to Uint8Array 780.15 ms/op 1.2078 s/op 0.65
migrate state 1000000 validators, 24 modified, 0 new 504.29 ms/op 646.72 ms/op 0.78
migrate state 1000000 validators, 1700 modified, 1000 new 705.75 ms/op 856.40 ms/op 0.82
migrate state 1000000 validators, 3400 modified, 2000 new 953.01 ms/op 973.32 ms/op 0.98
migrate state 1500000 validators, 24 modified, 0 new 549.05 ms/op 643.10 ms/op 0.85
migrate state 1500000 validators, 1700 modified, 1000 new 758.83 ms/op 1.1579 s/op 0.66
migrate state 1500000 validators, 3400 modified, 2000 new 948.24 ms/op 1.3841 s/op 0.69
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.7400 ns/op 5.7500 ns/op 1.17
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0452 us/op 704.56 ns/op 1.48
computeProposers - vc 250000 6.6468 ms/op 8.9420 ms/op 0.74
computeEpochShuffling - vc 250000 83.024 ms/op 111.34 ms/op 0.75
getNextSyncCommittee - vc 250000 103.27 ms/op 159.30 ms/op 0.65
computeSigningRoot for AttestationData 25.384 us/op 24.495 us/op 1.04
hash AttestationData serialized data then Buffer.toString(base64) 1.3122 us/op 1.8631 us/op 0.70
toHexString serialized data 857.06 ns/op 1.2931 us/op 0.66
Buffer.toString(base64) 157.23 ns/op 248.91 ns/op 0.63

by benchmarkbot/action

@nflaig
Copy link
Member

nflaig commented Aug 1, 2024

should all chain events be wrapped in a callOnNextEventLoop ? In practice, it seems that the validator only subscribes to the head event so it shouldn't matter

I noticed Vouch is subscribing to block event but it's not time-sensitive as it is just used for internal block<>slot mapping, so we should be fine to delay it slightly.

@wemeetagain wemeetagain merged commit e1dec02 into unstable Aug 2, 2024
21 checks passed
@wemeetagain wemeetagain deleted the cayman/fix-chain-event-emit branch August 2, 2024 13:15
@wemeetagain
Copy link
Member Author

🎉 This PR is included in v1.21.0 🎉

philknows pushed a commit that referenced this pull request Sep 3, 2024
* chore: refactor chain event emits

* chore: wrap emits in callInNextEventLoop
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.

3 participants