From a87840522f91147a3270450e2b4750c02611732b Mon Sep 17 00:00:00 2001 From: Dima Golovinov Date: Wed, 4 Sep 2024 12:04:22 +0200 Subject: [PATCH] Get rid of removeAll to boost baseline calculation performance --- .../java/com/jetbrains/qodana/sarif/baseline/Baseline.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/Baseline.kt b/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/Baseline.kt index 1e18fd0..47bf400 100644 --- a/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/Baseline.kt +++ b/sarif/src/main/java/com/jetbrains/qodana/sarif/baseline/Baseline.kt @@ -65,7 +65,10 @@ internal fun applyBaseline(report: Run, baseline: Run, options: Options): DiffSt .forEach { result -> //compare with all equal indicators val matchedResults = result.equalIndicators.flatMap(reportIndex::getOrEmpty).toSet() - val removed = undecidedFromReport.removeAll(matchedResults) + var removed = false + for (matchedResult in matchedResults) { + removed = removed || undecidedFromReport.remove(matchedResult) + } if (removed) { //leads to eliminating problems with the same hash