Skip to content

Commit 618d3d5

Browse files
committed
perf(linter): reduce iterations when collecting directories for nested configs
1 parent 4f50750 commit 618d3d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/oxlint/src/lint.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ impl LintRunner {
444444
while let Some(dir) = current {
445445
// NOTE: Initial benchmarking showed that it was faster to iterate over the directories twice
446446
// rather than constructing the configs in one iteration. It's worth re-benchmarking that though.
447-
directories.insert(dir);
447+
let inserted = directories.insert(dir);
448+
if !inserted {
449+
break;
450+
}
448451
current = dir.parent();
449452
}
450453
}

0 commit comments

Comments
 (0)