-
Notifications
You must be signed in to change notification settings - Fork 12
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
Extend declare_lint_pass!
macro
#228
Conversation
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.
In general looks good to me, although I'm still bad with the macro syntax, so can't say much about that (seriously, probably one of the worst looking parts of Rust, IMO).
I'm curious: Do you have any benchmarks (even if it's just a simple timing of running the linter on some random repo) by how much this improves the performance?
"excluded" -> "omitted" Co-authored-by: TimJentzsch <[email protected]>
Looks really good, makes defining lints so much easier!! |
For the
Instead, it's a simple I don't think caching symbols will have visible performance effects on the linter right now, but they may add up if we have as many lints as Clippy does. On another note, we don't have benchmarks tracking the time of the entire linter being run on a project. I would like to setup something like that eventually, so we can track the performance of individual lints. Footnotes
|
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.
Thanks, then it's fine for me now.
Let's create a follow-up issue to set up some basic way to compare performance, even if it's only logging the time instead of comprehensive benchmarking like with criterion
Often lints need to compare
Symbol
s. Some lints take the inefficient route by interning the string each time:This is bad because interning a string is quite expensive. To avoid this, lint passes cache the
Symbol
:This requires a lot of boilerplate. To shorten this, this PR introduces a custom
declare_bevy_lint_pass!
macro that supports cached values:Eventually this macro will be used to declare custom lint config, but for now it just supports default values. I've migrated all existing lints to use
declare_bevy_lint_pass!
.