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

Avoid recomputing state.previous_epoch #3256

Closed
wants to merge 1 commit into from

Conversation

paulhauner
Copy link
Member

Issue Addressed

NA

Proposed Changes

Much to my surprise, BeaconState::previous_epoch has been showing up in flamegraphs! This PR removes repeated calls to it.

Benchmarks

Benchmarks on a recent mainnet state using #3252 to get timing.

These tests were run with optimisations #3254 and #3255 already applied.

Without this PR

lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:56:29Z INFO  lcli::skip_slots] Run 0: 104.628252ms
[2022-06-09T08:56:29Z INFO  lcli::skip_slots] Run 1: 83.104139ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 2: 84.025086ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 3: 84.747254ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 4: 83.197275ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 5: 83.390297ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 6: 83.057175ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 7: 85.289398ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 8: 83.081438ms
[2022-06-09T08:56:30Z INFO  lcli::skip_slots] Run 9: 82.661783ms

With this PR

lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 0: 73.898678ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 1: 75.536978ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 2: 75.176104ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 3: 76.460828ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 4: 75.904195ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 5: 75.53077ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 6: 74.745572ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 7: 75.823489ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 8: 74.892055ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 9: 76.333569ms

Additional Info

@paulhauner paulhauner added blocked work-in-progress PR is a work-in-progress labels Jun 9, 2022
@paulhauner
Copy link
Member Author

I'll reopen another PR with this change combined with others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked work-in-progress PR is a work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant