Skip to content

Commit d7d4f0a

Browse files
authored
Optimize baseline filtering (#912)
1 parent ec31939 commit d7d4f0a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
- Fix unused import false-positives where the only referenced declaration is generated by a macro.
1414
- Fix building with Bazel on Linux by excluding Xcode support.
15+
- Fix slow baseline filtering for large projects with many results.
1516

1617
## 3.1.0 (2025-04-05)
1718

Sources/PeripheryKit/Results/OutputDeclarationFilter.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ public final class OutputDeclarationFilter {
2020

2121
if let baseline {
2222
var didFilterDeclaration = false
23+
let ignoredUsrs = declarations
24+
.flatMapSet(\.usrs)
25+
.intersection(baseline.usrs)
26+
2327
declarations = declarations.filter {
24-
let isDisjoint = $0.usrs.isDisjoint(with: baseline.usrs)
25-
if !isDisjoint {
28+
let isIgnored = $0.usrs.contains { ignoredUsrs.contains($0) }
29+
if isIgnored {
2630
didFilterDeclaration = true
2731
}
28-
return isDisjoint
32+
return !isIgnored
2933
}
3034

3135
if !didFilterDeclaration {

0 commit comments

Comments
 (0)