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 parsing the root configuration twice #10625
Conversation
|
@@ -207,6 +207,15 @@ impl RuleSet { | |||
*self = set.union(&RuleSet::from_rule(rule)); | |||
} | |||
|
|||
#[inline] | |||
pub fn set(&mut self, rule: Rule, enabled: bool) { |
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.
This is kind of unrelated but I noticed that we can simplify configuration.rs
a bit
let mut rule_selections = config.rule_selections; | ||
rule_selections.extend(self.rule_selections); | ||
|
||
let mut extend_safe_fixes = config.extend_safe_fixes; | ||
extend_safe_fixes.extend(self.extend_safe_fixes); | ||
|
||
let mut extend_unsafe_fixes = config.extend_unsafe_fixes; | ||
extend_unsafe_fixes.extend(self.extend_unsafe_fixes); | ||
|
||
let mut extend_per_file_ignores = config.extend_per_file_ignores; | ||
extend_per_file_ignores.extend(self.extend_per_file_ignores); |
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.
Another unrelated config change. It avoids allocating a new Vec
and instead reuses the existing vector.
a6331cc
to
088771e
Compare
088771e
to
926ac20
Compare
Summary
I debugged #10622 and noticed that the root configuration is always resolved twice. This PR changes
python_files_in_path
to stop searching for configurations if it reached the root-configuration directory (because we can't find any more specific configuration).Test Plan
I added debug statements to verify that
into_settings
is no longer called twice for the root configuration.I see a 4% speedup when running the CPython all cached benchmarks with the default rule selection