diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/filter/SpecFilterTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/filter/SpecFilterTest.java index 2001fcc369..8d6771c361 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/filter/SpecFilterTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/filter/SpecFilterTest.java @@ -173,12 +173,20 @@ private void validateParameters(Operation operation) { } } + private OpenAPI openAPI; + + @Setup(Level.Trial) + public void setUp() throws IOException { + // RK: Move I/O outside the benchmark to reduce variability. + openAPI = getOpenAPI(RESOURCE_PATH); + } + + @Param({"10", "100", "1000"}) + private int numThreads; + @Test(description = "it should clone everything concurrently") @Benchmark public void cloneEverythingConcurrent() throws IOException { - int numThreads = 10; - final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH); - ThreadGroup tg = new ThreadGroup("SpecFilterTest" + "|" + System.currentTimeMillis()); final Map filteredMap = new ConcurrentHashMap<>(); for (int i = 0; i < numThreads; i++) {