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

fix: gossipsub to yield more to the macro queue #5664

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jun 18, 2023

Motivation

Description

part of #5556
part of #5604

Test result on mainnet node

Screenshot 2023-06-18 at 15 29 36

the 1st event loop lag metric is not a big difference , but it's still better than unstable (from 12h)

Screenshot 2023-06-18 at 15 29 20

the 2nd event loop lag is clearly better

Screenshot 2023-06-18 at 15 35 49

especially the incoming request handler time

Screenshot 2023-06-18 at 15 30 59

also outgoing request time
Screenshot 2023-06-18 at 15 31 47

it helps our peers more stable, more peers want to stay with us
Screenshot 2023-06-18 at 15 33 06

@twoeths twoeths requested a review from a team as a code owner June 18, 2023 08:42
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 376a89d Previous: 483aad7 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 734.39 us/op 739.13 us/op 0.99
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 44.726 us/op 45.357 us/op 0.99
BLS verify - blst-native 1.1776 ms/op 1.2047 ms/op 0.98
BLS verifyMultipleSignatures 3 - blst-native 2.3895 ms/op 2.4485 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst-native 5.1217 ms/op 5.2533 ms/op 0.97
BLS verifyMultipleSignatures 32 - blst-native 18.614 ms/op 19.002 ms/op 0.98
BLS aggregatePubkeys 32 - blst-native 24.946 us/op 25.511 us/op 0.98
BLS aggregatePubkeys 128 - blst-native 96.958 us/op 99.338 us/op 0.98
getAttestationsForBlock 52.081 ms/op 50.441 ms/op 1.03
isKnown best case - 1 super set check 274.00 ns/op 260.00 ns/op 1.05
isKnown normal case - 2 super set checks 264.00 ns/op 249.00 ns/op 1.06
isKnown worse case - 16 super set checks 261.00 ns/op 256.00 ns/op 1.02
CheckpointStateCache - add get delete 4.8140 us/op 4.8840 us/op 0.99
validate gossip signedAggregateAndProof - struct 2.7280 ms/op 2.7509 ms/op 0.99
validate gossip attestation - struct 1.2689 ms/op 1.3143 ms/op 0.97
pickEth1Vote - no votes 1.2312 ms/op 1.2265 ms/op 1.00
pickEth1Vote - max votes 9.6777 ms/op 10.347 ms/op 0.94
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.6540 ms/op 8.6894 ms/op 1.00
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.866 ms/op 14.296 ms/op 1.04
pickEth1Vote - Eth1Data fastSerialize value x2048 641.89 us/op 636.44 us/op 1.01
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.8991 ms/op 6.6705 ms/op 1.18
bytes32 toHexString 493.00 ns/op 486.00 ns/op 1.01
bytes32 Buffer.toString(hex) 354.00 ns/op 343.00 ns/op 1.03
bytes32 Buffer.toString(hex) from Uint8Array 548.00 ns/op 549.00 ns/op 1.00
bytes32 Buffer.toString(hex) + 0x 342.00 ns/op 342.00 ns/op 1.00
Object access 1 prop 0.16200 ns/op 0.16400 ns/op 0.99
Map access 1 prop 0.16900 ns/op 0.15600 ns/op 1.08
Object get x1000 6.7640 ns/op 6.7030 ns/op 1.01
Map get x1000 0.57400 ns/op 0.51300 ns/op 1.12
Object set x1000 51.931 ns/op 52.835 ns/op 0.98
Map set x1000 43.179 ns/op 44.072 ns/op 0.98
Return object 10000 times 0.23680 ns/op 0.23880 ns/op 0.99
Throw Error 10000 times 4.2193 us/op 4.2119 us/op 1.00
fastMsgIdFn sha256 / 200 bytes 3.4380 us/op 3.4700 us/op 0.99
fastMsgIdFn h32 xxhash / 200 bytes 279.00 ns/op 281.00 ns/op 0.99
fastMsgIdFn h64 xxhash / 200 bytes 396.00 ns/op 383.00 ns/op 1.03
fastMsgIdFn sha256 / 1000 bytes 11.662 us/op 11.764 us/op 0.99
fastMsgIdFn h32 xxhash / 1000 bytes 408.00 ns/op 420.00 ns/op 0.97
fastMsgIdFn h64 xxhash / 1000 bytes 467.00 ns/op 474.00 ns/op 0.99
fastMsgIdFn sha256 / 10000 bytes 104.36 us/op 103.51 us/op 1.01
fastMsgIdFn h32 xxhash / 10000 bytes 1.9160 us/op 1.9270 us/op 0.99
fastMsgIdFn h64 xxhash / 10000 bytes 1.4060 us/op 1.3640 us/op 1.03
enrSubnets - fastDeserialize 64 bits 1.2900 us/op 1.2750 us/op 1.01
enrSubnets - ssz BitVector 64 bits 489.00 ns/op 478.00 ns/op 1.02
enrSubnets - fastDeserialize 4 bits 174.00 ns/op 165.00 ns/op 1.05
enrSubnets - ssz BitVector 4 bits 505.00 ns/op 480.00 ns/op 1.05
prioritizePeers score -10:0 att 32-0.1 sync 2-0 101.60 us/op 104.64 us/op 0.97
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 126.15 us/op 129.67 us/op 0.97
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 157.31 us/op 169.17 us/op 0.93
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 288.70 us/op 304.98 us/op 0.95
prioritizePeers score 0:0 att 64-1 sync 4-1 352.51 us/op 364.35 us/op 0.97
array of 16000 items push then shift 1.5652 us/op 1.6114 us/op 0.97
LinkedList of 16000 items push then shift 8.3600 ns/op 8.8030 ns/op 0.95
array of 16000 items push then pop 78.686 ns/op 78.051 ns/op 1.01
LinkedList of 16000 items push then pop 8.2270 ns/op 8.5320 ns/op 0.96
array of 24000 items push then shift 2.2397 us/op 2.3406 us/op 0.96
LinkedList of 24000 items push then shift 8.4750 ns/op 8.6430 ns/op 0.98
array of 24000 items push then pop 70.669 ns/op 70.065 ns/op 1.01
LinkedList of 24000 items push then pop 8.3410 ns/op 8.3840 ns/op 0.99
intersect bitArray bitLen 8 12.987 ns/op 13.154 ns/op 0.99
intersect array and set length 8 76.373 ns/op 76.902 ns/op 0.99
intersect bitArray bitLen 128 43.032 ns/op 43.741 ns/op 0.98
intersect array and set length 128 1.0388 us/op 1.0573 us/op 0.98
Buffer.concat 32 items 3.0050 us/op 2.7430 us/op 1.10
Uint8Array.set 32 items 2.8820 us/op 2.5280 us/op 1.14
transfer serialized Status (84 B) 2.1710 us/op 2.0420 us/op 1.06
copy serialized Status (84 B) 1.8370 us/op 1.8190 us/op 1.01
transfer serialized SignedVoluntaryExit (112 B) 2.3400 us/op 2.2260 us/op 1.05
copy serialized SignedVoluntaryExit (112 B) 1.9050 us/op 1.8430 us/op 1.03
transfer serialized ProposerSlashing (416 B) 3.0280 us/op 2.8120 us/op 1.08
copy serialized ProposerSlashing (416 B) 3.0280 us/op 2.8890 us/op 1.05
transfer serialized Attestation (485 B) 3.0150 us/op 3.2780 us/op 0.92
copy serialized Attestation (485 B) 2.9950 us/op 3.2440 us/op 0.92
transfer serialized AttesterSlashing (33232 B) 2.8680 us/op 3.3590 us/op 0.85
copy serialized AttesterSlashing (33232 B) 6.0190 us/op 6.5930 us/op 0.91
transfer serialized Small SignedBeaconBlock (128000 B) 3.4420 us/op 3.6430 us/op 0.94
copy serialized Small SignedBeaconBlock (128000 B) 13.380 us/op 13.825 us/op 0.97
transfer serialized Avg SignedBeaconBlock (200000 B) 3.6990 us/op 3.8560 us/op 0.96
copy serialized Avg SignedBeaconBlock (200000 B) 19.012 us/op 19.844 us/op 0.96
transfer serialized BlobsSidecar (524380 B) 3.3890 us/op 3.6630 us/op 0.93
copy serialized BlobsSidecar (524380 B) 167.28 us/op 97.505 us/op 1.72
transfer serialized Big SignedBeaconBlock (1000000 B) 3.5650 us/op 3.6920 us/op 0.97
copy serialized Big SignedBeaconBlock (1000000 B) 172.04 us/op 246.86 us/op 0.70
pass gossip attestations to forkchoice per slot 2.6537 ms/op 2.6318 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 2.1119 ms/op 2.0061 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 0 11.515 ms/op 11.589 ms/op 0.99
forkChoice updateHead vc 1000000 bc 64 eq 0 20.890 ms/op 20.798 ms/op 1.00
forkChoice updateHead vc 600000 bc 320 eq 0 16.934 ms/op 16.820 ms/op 1.01
forkChoice updateHead vc 600000 bc 1200 eq 0 80.011 ms/op 79.254 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 1000 20.880 ms/op 19.974 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 10000 22.864 ms/op 22.211 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 300000 30.324 ms/op 31.183 ms/op 0.97
computeDeltas 3.9874 ms/op 3.9755 ms/op 1.00
computeProposerBoostScoreFromBalances 1.7829 ms/op 1.7596 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei normalcase 2.1049 ms/op 2.0648 ms/op 1.02
altair processAttestation - 250000 vs - 7PWei worstcase 3.5701 ms/op 3.2650 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 140.10 us/op 137.68 us/op 1.02
altair processAttestation - setStatus - 1/3 committees join 278.36 us/op 271.45 us/op 1.03
altair processAttestation - setStatus - 1/2 committees join 370.52 us/op 353.89 us/op 1.05
altair processAttestation - setStatus - 2/3 committees join 471.00 us/op 443.78 us/op 1.06
altair processAttestation - setStatus - 4/5 committees join 640.00 us/op 646.53 us/op 0.99
altair processAttestation - setStatus - 100% committees join 758.82 us/op 751.56 us/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase 17.014 ms/op 17.885 ms/op 0.95
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.747 ms/op 28.495 ms/op 0.90
altair processBlock - 250000 vs - 7PWei worstcase 46.432 ms/op 48.210 ms/op 0.96
altair processBlock - 250000 vs - 7PWei worstcase hashState 67.356 ms/op 70.030 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 1.9855 ms/op 1.9028 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei worstcase 27.762 ms/op 28.549 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 451.21 us/op 466.44 us/op 0.97
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.7890 us/op 7.0420 us/op 0.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 19.269 us/op 20.375 us/op 0.95
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 8.1480 us/op 8.2480 us/op 0.99
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.5080 us/op 6.2380 us/op 1.04
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 74.159 us/op 80.180 us/op 0.92
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 601.42 us/op 620.62 us/op 0.97
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 897.64 us/op 905.86 us/op 0.99
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 890.46 us/op 862.36 us/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.1584 ms/op 2.1709 ms/op 0.99
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.6792 ms/op 1.7393 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.9000 ms/op 3.8309 ms/op 1.02
Tree 40 250000 create 289.44 ms/op 294.20 ms/op 0.98
Tree 40 250000 get(125000) 178.70 ns/op 169.66 ns/op 1.05
Tree 40 250000 set(125000) 896.36 ns/op 833.68 ns/op 1.08
Tree 40 250000 toArray() 17.071 ms/op 16.574 ms/op 1.03
Tree 40 250000 iterate all - toArray() + loop 16.856 ms/op 16.493 ms/op 1.02
Tree 40 250000 iterate all - get(i) 66.156 ms/op 63.480 ms/op 1.04
MutableVector 250000 create 10.640 ms/op 9.9738 ms/op 1.07
MutableVector 250000 get(125000) 6.6760 ns/op 6.4430 ns/op 1.04
MutableVector 250000 set(125000) 252.55 ns/op 222.80 ns/op 1.13
MutableVector 250000 toArray() 2.7651 ms/op 2.7527 ms/op 1.00
MutableVector 250000 iterate all - toArray() + loop 2.8592 ms/op 2.7444 ms/op 1.04
MutableVector 250000 iterate all - get(i) 1.4696 ms/op 1.4249 ms/op 1.03
Array 250000 create 2.5127 ms/op 2.4018 ms/op 1.05
Array 250000 clone - spread 1.2037 ms/op 1.0316 ms/op 1.17
Array 250000 get(125000) 0.57300 ns/op 0.51200 ns/op 1.12
Array 250000 set(125000) 0.65200 ns/op 0.58500 ns/op 1.11
Array 250000 iterate all - loop 97.919 us/op 101.43 us/op 0.97
effectiveBalanceIncrements clone Uint8Array 300000 29.911 us/op 24.066 us/op 1.24
effectiveBalanceIncrements clone MutableVector 300000 380.00 ns/op 307.00 ns/op 1.24
effectiveBalanceIncrements rw all Uint8Array 300000 162.14 us/op 161.44 us/op 1.00
effectiveBalanceIncrements rw all MutableVector 300000 82.086 ms/op 72.886 ms/op 1.13
phase0 afterProcessEpoch - 250000 vs - 7PWei 112.50 ms/op 110.48 ms/op 1.02
phase0 beforeProcessEpoch - 250000 vs - 7PWei 32.741 ms/op 40.012 ms/op 0.82
altair processEpoch - mainnet_e81889 327.86 ms/op 297.21 ms/op 1.10
mainnet_e81889 - altair beforeProcessEpoch 66.905 ms/op 62.535 ms/op 1.07
mainnet_e81889 - altair processJustificationAndFinalization 16.021 us/op 16.385 us/op 0.98
mainnet_e81889 - altair processInactivityUpdates 5.2435 ms/op 5.0540 ms/op 1.04
mainnet_e81889 - altair processRewardsAndPenalties 64.464 ms/op 66.348 ms/op 0.97
mainnet_e81889 - altair processRegistryUpdates 2.4460 us/op 2.6880 us/op 0.91
mainnet_e81889 - altair processSlashings 450.00 ns/op 524.00 ns/op 0.86
mainnet_e81889 - altair processEth1DataReset 517.00 ns/op 560.00 ns/op 0.92
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2263 ms/op 1.2330 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 4.0140 us/op 4.5440 us/op 0.88
mainnet_e81889 - altair processRandaoMixesReset 4.5310 us/op 4.5500 us/op 1.00
mainnet_e81889 - altair processHistoricalRootsUpdate 732.00 ns/op 712.00 ns/op 1.03
mainnet_e81889 - altair processParticipationFlagUpdates 2.3630 us/op 2.0400 us/op 1.16
mainnet_e81889 - altair processSyncCommitteeUpdates 504.00 ns/op 918.00 ns/op 0.55
mainnet_e81889 - altair afterProcessEpoch 125.08 ms/op 121.06 ms/op 1.03
phase0 processEpoch - mainnet_e58758 354.47 ms/op 356.61 ms/op 0.99
mainnet_e58758 - phase0 beforeProcessEpoch 134.66 ms/op 131.21 ms/op 1.03
mainnet_e58758 - phase0 processJustificationAndFinalization 17.362 us/op 17.219 us/op 1.01
mainnet_e58758 - phase0 processRewardsAndPenalties 62.386 ms/op 60.687 ms/op 1.03
mainnet_e58758 - phase0 processRegistryUpdates 8.5600 us/op 7.7840 us/op 1.10
mainnet_e58758 - phase0 processSlashings 486.00 ns/op 546.00 ns/op 0.89
mainnet_e58758 - phase0 processEth1DataReset 497.00 ns/op 570.00 ns/op 0.87
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 941.13 us/op 944.91 us/op 1.00
mainnet_e58758 - phase0 processSlashingsReset 3.7500 us/op 3.7570 us/op 1.00
mainnet_e58758 - phase0 processRandaoMixesReset 4.3300 us/op 4.6570 us/op 0.93
mainnet_e58758 - phase0 processHistoricalRootsUpdate 626.00 ns/op 726.00 ns/op 0.86
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.0680 us/op 4.3760 us/op 0.93
mainnet_e58758 - phase0 afterProcessEpoch 97.824 ms/op 95.123 ms/op 1.03
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.1940 ms/op 1.2173 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4328 ms/op 1.4262 ms/op 1.00
altair processInactivityUpdates - 250000 normalcase 24.202 ms/op 23.758 ms/op 1.02
altair processInactivityUpdates - 250000 worstcase 26.289 ms/op 25.993 ms/op 1.01
phase0 processRegistryUpdates - 250000 normalcase 8.0020 us/op 6.9380 us/op 1.15
phase0 processRegistryUpdates - 250000 badcase_full_deposits 249.42 us/op 233.84 us/op 1.07
phase0 processRegistryUpdates - 250000 worstcase 0.5 127.33 ms/op 126.67 ms/op 1.01
altair processRewardsAndPenalties - 250000 normalcase 68.637 ms/op 66.822 ms/op 1.03
altair processRewardsAndPenalties - 250000 worstcase 69.683 ms/op 70.189 ms/op 0.99
phase0 getAttestationDeltas - 250000 normalcase 7.9307 ms/op 6.4507 ms/op 1.23
phase0 getAttestationDeltas - 250000 worstcase 6.9481 ms/op 6.3789 ms/op 1.09
phase0 processSlashings - 250000 worstcase 3.7411 ms/op 3.4635 ms/op 1.08
altair processSyncCommitteeUpdates - 250000 176.71 ms/op 166.68 ms/op 1.06
BeaconState.hashTreeRoot - No change 342.00 ns/op 256.00 ns/op 1.34
BeaconState.hashTreeRoot - 1 full validator 53.230 us/op 52.367 us/op 1.02
BeaconState.hashTreeRoot - 32 full validator 531.16 us/op 516.90 us/op 1.03
BeaconState.hashTreeRoot - 512 full validator 5.7823 ms/op 5.5523 ms/op 1.04
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 66.155 us/op 62.563 us/op 1.06
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 909.79 us/op 874.63 us/op 1.04
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.989 ms/op 10.834 ms/op 1.11
BeaconState.hashTreeRoot - 1 balances 51.753 us/op 47.610 us/op 1.09
BeaconState.hashTreeRoot - 32 balances 455.38 us/op 454.32 us/op 1.00
BeaconState.hashTreeRoot - 512 balances 4.5642 ms/op 4.2618 ms/op 1.07
BeaconState.hashTreeRoot - 250000 balances 74.875 ms/op 68.552 ms/op 1.09
aggregationBits - 2048 els - zipIndexesInBitList 16.847 us/op 15.115 us/op 1.11
regular array get 100000 times 33.519 us/op 32.371 us/op 1.04
wrappedArray get 100000 times 33.352 us/op 32.350 us/op 1.03
arrayWithProxy get 100000 times 16.690 ms/op 15.431 ms/op 1.08
ssz.Root.equals 549.00 ns/op 536.00 ns/op 1.02
byteArrayEquals 548.00 ns/op 529.00 ns/op 1.04
shuffle list - 16384 els 6.8269 ms/op 6.7194 ms/op 1.02
shuffle list - 250000 els 99.008 ms/op 98.262 ms/op 1.01
processSlot - 1 slots 8.1200 us/op 8.5480 us/op 0.95
processSlot - 32 slots 1.2824 ms/op 1.3011 ms/op 0.99
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 37.482 ms/op 37.217 ms/op 1.01
getCommitteeAssignments - req 1 vs - 250000 vc 2.7681 ms/op 2.8384 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 3.9314 ms/op 4.0267 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4243 ms/op 4.3924 ms/op 1.01
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.5900 ns/op 4.2900 ns/op 1.07
state getBlockRootAtSlot - 250000 vs - 7PWei 785.57 ns/op 919.52 ns/op 0.85
computeProposers - vc 250000 10.127 ms/op 10.158 ms/op 1.00
computeEpochShuffling - vc 250000 98.045 ms/op 99.233 ms/op 0.99
getNextSyncCommittee - vc 250000 174.95 ms/op 176.55 ms/op 0.99
computeSigningRoot for AttestationData 13.982 us/op 13.281 us/op 1.05
hash AttestationData serialized data then Buffer.toString(base64) 2.4336 us/op 2.3358 us/op 1.04
toHexString serialized data 1.0591 us/op 1.0182 us/op 1.04
Buffer.toString(base64) 321.25 ns/op 303.60 ns/op 1.06

by benchmarkbot/action

@twoeths twoeths merged commit 5699333 into unstable Jun 19, 2023
@twoeths twoeths deleted the tuyen/report_message_validation_result_on_timeout branch June 19, 2023 08:24
@twoeths
Copy link
Contributor Author

twoeths commented Jun 19, 2023

attaching the profile of network thread of this branch

network_thread_2023-06-19T08:39:44.576Z.cpuprofile.zip

there are still some runMicroTasks call takes up to 400ms (but previously I can found one with 1.1s)

Screenshot 2023-06-19 at 15 52 13

twoeths added a commit that referenced this pull request Jun 29, 2023
* fix: add setTimeout to onGossipsubMessage and onValidationResult

* chore: more comments
@philknows philknows mentioned this pull request Jun 29, 2023
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.1 🎉

@nflaig
Copy link
Member

nflaig commented Jul 14, 2023

On the topic of setImmediate vs setTimeout(0), I have gathered metrics on this (changes in this branch d674bd1) and there is no noticeable improvement.

I think this is due to the fact that we yield to the event loop after I/O polling most of the time so it does not really make a difference. In fact, I think setTimeout(0) might even be better because this queues those tasks to be executed after already pending timers.

There might be some potential if we only use setImmediate in few specific places but that will likely be hard to measure.

cc @matthewkeil

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.10.0 🎉

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.

4 participants