-
Notifications
You must be signed in to change notification settings - Fork 992
BeaconState::apply_pending_mutations is slow with changes to validators #9003
Copy link
Copy link
Closed
Labels
consensusAn issue/PR that touches consensus code, such as state_processing or block verification.An issue/PR that touches consensus code, such as state_processing or block verification.optimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.
Description
Description
@chong-he and I debugged an issue in BeaconState::apply_pending_mutations where small changes in validators blow out the time required to apply updates.
E.g. for the block at slot 13919998, there are 2 validators that exit, and this creates ~140ms of work in apply_pending_mutations! Gross!
Here's the augmented lcli output:
Mar 19 16:03:42.354 DEBUG Slot processing: 24.12µs
Mar 19 16:03:42.354 DEBUG Build all caches (again): 11.26µs
Mar 19 16:03:42.384 DEBUG Batch verify block signatures: 29.716626ms
Mar 19 16:03:42.483 DEBUG Process block: 99.235892ms
Mar 19 16:03:42.489 DEBUG balances apply updates: 5ms
Mar 19 16:03:42.489 DEBUG previous epoch participation apply updates: 0ms
Mar 19 16:03:42.499 DEBUG current epoch participation apply updates: 10ms
Mar 19 16:03:42.500 DEBUG field 0 apply updates: 0ms
Mar 19 16:03:42.500 DEBUG field 1 apply updates: 0ms
Mar 19 16:03:42.500 DEBUG field 2 apply updates: 0ms
Mar 19 16:03:42.500 DEBUG field 3 apply updates: 0ms
Mar 19 16:03:42.641 DEBUG field 4 apply updates: 141ms
Mar 19 16:03:42.642 DEBUG field 5 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 6 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 7 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 8 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 9 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 10 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 11 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 12 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 13 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 14 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG field 15 apply updates: 0ms
Mar 19 16:03:42.642 DEBUG apply_pending_mutations: 142ms
Mar 19 16:03:42.644 DEBUG Post-block tree hash: 161.479991ms
Need to do some more digging to optimise this out. Will likely require changes inside milhouse's with_updated_leaves.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
consensusAn issue/PR that touches consensus code, such as state_processing or block verification.An issue/PR that touches consensus code, such as state_processing or block verification.optimizationSomething to make Lighthouse run more efficiently.Something to make Lighthouse run more efficiently.