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

Potential performance issue in initiateValidatorExit() #2342

Closed
dapplion opened this issue Apr 8, 2021 · 4 comments · Fixed by #2695
Closed

Potential performance issue in initiateValidatorExit() #2342

dapplion opened this issue Apr 8, 2021 · 4 comments · Fixed by #2695
Assignees
Labels
prio-high Resolve issues as soon as possible. scope-performance Performance issue and ideas to improve performance.

Comments

@dapplion
Copy link
Contributor

dapplion commented Apr 8, 2021

Describe the bug

Every time initiateValidatorExit() is called it iterates over the entire validators array. initiateValidatorExit may be called multiple times per block with the right conditions.

const exitQueueChurn = Array.from(state.validators).filter((v: phase0.Validator) => v.exitEpoch === exitQueueEpoch)

Expected behavior

We should do something smarter and cache this computation

@twoeths
Copy link
Contributor

twoeths commented Apr 9, 2021

there is a performance test for it

it("should process multiple validator exits in same block", async () => {

@stale
Copy link

stale bot commented Jun 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the bot:stale label Jun 9, 2021
@dapplion dapplion closed this as completed Jun 9, 2021
@dapplion dapplion reopened this Jun 9, 2021
@stale stale bot removed the bot:stale label Jun 9, 2021
@dapplion
Copy link
Contributor Author

dapplion commented Jun 9, 2021

@tuyennhv do we have a performance problem? Processing a block with 16 exits is a x100 times slower..

Process regular block                                                  172.8628 ops/s      5.784933 ms/op   2581 runs
Process blocks with 16 validator exits                                 1.727984 ops/s      578.7092 ms/op    512 runs

@dapplion dapplion added scope-performance Performance issue and ideas to improve performance. prio-high Resolve issues as soon as possible. labels Jun 10, 2021
@twoeths
Copy link
Contributor

twoeths commented Jun 11, 2021

@tuyennhv do we have a performance problem? Processing a block with 16 exits is a x100 times slower..

Process regular block                                                  172.8628 ops/s      5.784933 ms/op   2581 runs
Process blocks with 16 validator exits                                 1.727984 ops/s      578.7092 ms/op    512 runs

yeah we should definitely improve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio-high Resolve issues as soon as possible. scope-performance Performance issue and ideas to improve performance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants