-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: assorted synthetic benchmarks for SyncState
#3868
feat: assorted synthetic benchmarks for SyncState
#3868
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
3ca31b0
to
13ae1bd
Compare
|| state.clone(), | ||
|mut state| { | ||
for i in *number_of_addresses..1 { | ||
use revm::db::State; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move all of the local use
statements to the top of the file. There is no benefit in Rust to have them locally, in this case.
Use cases where it would be helpful is:
- if you have conflicting naming; or
- if you are including
use
statement in a scope that's behind a feature flag, as you'd also need to put theuse
statement itself behind the feature flag if you do it at the top of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I've been stubborn about this, and I realize that there is no benefit in Rust, but as a reader of the code I actually find it immensely beneficial. Given that such imported traits have no direct mention in the file, I appreciate having their placement restricted to the scope they're actually needed in. If that scope is the entire file, due to repeated uses within the file, then at the top of the file is the right place. But if the use is only in a single inner scope, then I feel that the placement should be within that single inner scope. (Note that in this particular case I do have a repetition of revm::db::State
within this file, but that's because I expect one of those usages to go away depending on which version of that function we end up keeping.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A language server provides you that information if you need a reminder though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but what if for example i'm just browsing the code on github? etc. maybe i'm being overly principled, but it doesn't seem right to depend on tooling for readability. in my latest draft all of the use
are at the top, by virtue of using SyncState
, so it's a moot point for this PR, but this does remain one of the (very) few smelly things in my limited Rust experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub these days also offers redirects to type definitions. It seems like you're trying to tailor to a niche while cluttering the code with unnecessary noise for the majority of use cases.
13ae1bd
to
b57d710
Compare
b57d710
to
8cd0357
Compare
tested with both, they're negligibly different, so reverted to the suggested default, SmallInput.
Addresses review comment #3868 (comment)
Addresses review comment #3868 (comment)
Co-authored-by: Wodann <Wodann@users.noreply.github.com>
Addresses review comment #3868 (comment)
Addresses review comment #3868 (comment)
SyncState
SyncState
SyncState
Co-authored-by: Wodann <Wodann@users.noreply.github.com>
Fixes NomicFoundation/edr#71