From 03499039557b0cda268a5e5b08e141099f9d4493 Mon Sep 17 00:00:00 2001 From: Nikita Katkov Date: Tue, 3 Dec 2024 14:56:22 +0100 Subject: [PATCH] [json] IJPL-172038 More performance improvements for json schema FUS - Prefer HashMap and HashSet over the Linked* collections to reduce overhead - Prefer strict enum type in a map - Run several test attempts to achieve more stable results (cherry picked from commit 8254f2317efc10450adb40168f8159120aa87915) IJ-CR-149952 GitOrigin-RevId: f8fde91b390057faa64ff4e8b40f9db67f9ac36e --- .../fus/JsonSchemaHighlightingSessionStatisticsCollector.kt | 2 +- .../com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/json/src/com/jetbrains/jsonSchema/fus/JsonSchemaHighlightingSessionStatisticsCollector.kt b/json/src/com/jetbrains/jsonSchema/fus/JsonSchemaHighlightingSessionStatisticsCollector.kt index 02229010aca9..9ed599835b8e 100644 --- a/json/src/com/jetbrains/jsonSchema/fus/JsonSchemaHighlightingSessionStatisticsCollector.kt +++ b/json/src/com/jetbrains/jsonSchema/fus/JsonSchemaHighlightingSessionStatisticsCollector.kt @@ -39,7 +39,7 @@ internal class JsonSchemaHighlightingSessionStatisticsCollector { } } - fun reportSchemaUsageFeature(featureKind: JsonSchemaFusFeature) { + fun reportSchemaUsageFeature(featureKind: JsonSchemaFusCountedFeature) { val currentSession = getCurrentSession() ?: return currentSession.featuresWithCount[featureKind] = currentSession.featuresWithCount.getOrDefault(featureKind, 0) + 1 } diff --git a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java index bd70788dca90..ee2eda87c552 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaPerformanceTest.java @@ -52,7 +52,7 @@ public class JsonSchemaPerformanceTest extends JsonSchemaHeavyAbstractTest { registerJsonSchema(myFixture, schemaText, "json", it -> true); myFixture.configureByFile("/azure-file.json"); myFixture.checkHighlighting(true, false, true); - }).start(); + }).attempts(5).start(); } public void testSwaggerHighlighting() {