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

Move exitQueue cache values to epochContext #2928

Merged
merged 3 commits into from
Aug 10, 2021
Merged

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Aug 9, 2021

Motivation

To speed up validator exits @tuyennhv added an optimization in #2695 to loop over validators one per exits on a block. This optimization can be taken further since the expensive computations can be done once per epoch only. Also the exitQueueEpoch and churn are already computed in epoch process.

Description

Moves exitQueueEpoch, exitQueueChurn and churnLimit cached values from blockProcess and epochProcess to epochContext. The values are available to epoch processing and block processing. Now no extra loop over the validators tree is necessary to initiate exits. Those constants are copied on epochCtx.copy() so they can be safely mutated on different forks.

@codeclimate
Copy link

codeclimate bot commented Aug 9, 2021

Code Climate has analyzed commit 3e3eb4a and detected 0 issues on this pull request.

View more on Code Climate.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2021

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 7c6528a Previous: 485ec69 Ratio
Process block - 250000 vs - 7PWei - with 1 validator exit 5.2830 ms/op 118.28 ms/op 0.04
Process block - 250000 vs - 7PWei - with 16 validator exits 8.6390 ms/op 32.546 ms/op 0.27
Full benchmark results
Benchmark suite Current: 7c6528a Previous: 485ec69 Ratio
getCommitteeAssignments - req 1000 vs - 250000 vc 7.9663 ms/op 9.2282 ms/op 0.86
epoch altair - 250000 vs - 7PWei - processInactivityUpdates 2.3855 s/op 3.0492 s/op 0.78
epoch altair - 250000 vs - 7PWei - processRewardsAndPenalties 1.1170 s/op 1.2325 s/op 0.91
epoch altair - 250000 vs - 7PWei - processParticipationFlagUpdates 361.55 ms/op 572.53 ms/op 0.63
Process block - 250000 vs - 7PWei - with 0 validator exit 5.2932 ms/op 13.147 ms/op 0.40
Process block - 250000 vs - 7PWei - with 1 validator exit 5.2830 ms/op 118.28 ms/op 0.04
Process block - 250000 vs - 7PWei - with 16 validator exits 8.6390 ms/op 32.546 ms/op 0.27
epoch phase0 - 250000 vs - 7PWei - beforeProcessEpoch 1.6624 s/op 1.8831 s/op 0.88
epoch phase0 - 250000 vs - 7PWei - processRewardsAndPenalties 809.31 ms/op 954.61 ms/op 0.85
epoch phase0 - 250000 vs - 7PWei - processEffectiveBalanceUpdates 144.70 ms/op 188.89 ms/op 0.77
getAttestationDeltas - 250000 vs - 7PWei 133.96 ms/op 136.41 ms/op 0.98
processSlots - 250000 vs - 7PWei - 32 empty slots 3.4361 s/op 3.8874 s/op 0.88
shuffle list - 16384 els 17.527 ms/op 37.375 ms/op 0.47
shuffle list - 250000 els 235.62 ms/op 529.31 ms/op 0.45
getPubkeys - persistent - req 1000 vs - 250000 vc 16.544 us/op 22.626 us/op 0.73
BLS verify - blst-native 1.8636 ms/op 2.3864 ms/op 0.78
BLS verifyMultipleSignatures 3 - blst-native 3.8116 ms/op 4.8731 ms/op 0.78
BLS verifyMultipleSignatures 8 - blst-native 8.2007 ms/op 10.422 ms/op 0.79
BLS verifyMultipleSignatures 32 - blst-native 32.596 ms/op 37.910 ms/op 0.86
BLS aggregatePubkeys 32 - blst-native 41.060 us/op 54.187 us/op 0.76
BLS aggregatePubkeys 128 - blst-native 155.67 us/op 200.91 us/op 0.77
getAttestationsForBlock 90.173 ms/op 146.81 ms/op 0.61
validate gossip signedAggregateAndProof - struct 4.0376 ms/op 7.6318 ms/op 0.53
validate gossip signedAggregateAndProof - treeBacked 4.0776 ms/op 5.9595 ms/op 0.68
validate gossip attestation - struct 1.8604 ms/op 2.7016 ms/op 0.69
validate gossip attestation - treeBacked 1.9748 ms/op 2.8023 ms/op 0.70

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/exitqueue branch 2 times, most recently from 707b896 to a3cdca1 Compare August 10, 2021 10:05
@dapplion dapplion merged commit c09ea9a into master Aug 10, 2021
@dapplion dapplion deleted the dapplion/exitqueue branch August 10, 2021 19:38
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.

None yet

2 participants