Skip to content

Commit

Permalink
Move variables outside benchmark.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Feb 21, 2024
1 parent 25023f2 commit 655760b
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, OpenAPI> filteredMap = new ConcurrentHashMap<>();
for (int i = 0; i < numThreads; i++) {
Expand Down

0 comments on commit 655760b

Please sign in to comment.