perf(linter): reduce unnecessary rule method executions to improve performance#8854
perf(linter): reduce unnecessary rule method executions to improve performance#8854shulaoda wants to merge 4 commits intooxc-project:mainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
e29e7b8 to
4470e6c
Compare
CodSpeed Performance ReportMerging #8854 will improve performances by 8.67%Comparing Summary
Benchmarks breakdown
|
When running on my windows machine ( |
c4bb5b0 to
a6c5dcd
Compare
|
Introducing |
Boshen
left a comment
There was a problem hiding this comment.
I like the overall direction, but dislike requiring
fn should_run(&self, _: &crate::ContextHost) -> crate::rule::ShouldRunMeta {
crate::rule::ShouldRunMeta::IS_RUN_ONCE
}
everywhere.
By default, If use |
|
Agreed with @Boshen: something like this is definitely worth doing, but maybe we can polish the experience a little bit more. My suggestion would be that maybe we can make it as part of the So maybe it would look more like this (without doc comments): declare_oxc_lint!(
SomeLintRule(IsRunOnSymbol),
oxc,
nursery
);Not 100% sure how to parse it like that though, not too familiar with macros |
This doesn't seem feasible (because declare_oxc_lint!(
SomeLintRule,
oxc,
nursery,
IsRunOnSymbol,
);or #[derive(Debug, Default, Clone)]
#[should_run(is_run_once)]
pub struct PreferToBeObject; |
|
Ok my decision is that the total amount of changes is not worth it for |
We can make full use of
should_runto avoid unnecessary iterations over nodes and rules.