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

perf(cheatcodes): outline cold paths in inspector step #8197

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Jun 19, 2024

Outlining (and marking as cold) the Inspector::step cold paths in the cheatcodes inspector (so gas metering, mapping etc) makes the function trivial to inline as it becomes just a few checks, as well as way more cache-friendly as it won't have to jump around thousands of bytes on the common case where all or most of the conditions are false.

Overall this makes forge 5% to 20% faster depending on the workload

@DaniPopes
Copy link
Member Author

DaniPopes commented Jun 19, 2024

The diff here is horrendous, basically the inner block of if let X = Y { ... } in fn step were moved to the bottom of the file in their own impl block, plus some refactors

@DaniPopes DaniPopes requested review from mattsse and klkvr and removed request for mattsse, Evalir and klkvr June 19, 2024 13:24
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but this impacts #8123

merging this first is the right way to do this.
depending on how big the conflicts are, perhaps you could then take a look at resolving them in #8123 ?

@DaniPopes DaniPopes merged commit bd5582b into master Jun 19, 2024
19 checks passed
@DaniPopes DaniPopes deleted the dani/outline-cheatcodes-step branch June 19, 2024 14:02
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.

2 participants