Skip to content

Commit

Permalink
Fix JMH benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ktoso committed Dec 16, 2024
1 parent 3e7ae28 commit 860f2aa
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ public static class BenchmarkState {
MySwiftClass obj;

@Setup(Level.Trial)
public void beforeALl() {
System.loadLibrary("swiftCore");
System.loadLibrary("ExampleSwiftLibrary");

// Tune down debug statements so they don't fill up stdout
System.setProperty("jextract.trace.downcalls", "false");

public void beforeAll() {
obj = new MySwiftClass(1, 2);
}
}

@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS)
public void simpleSwiftApiCall(BenchmarkState state, Blackhole blackhole) {
blackhole.consume(state.obj.makeRandomIntMethod());
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public long simpleSwiftApiCall(BenchmarkState state, Blackhole blackhole) {
return state.obj.makeRandomIntMethod();
}
}

0 comments on commit 860f2aa

Please sign in to comment.