Skip to content

Commit

Permalink
Use @teardown(Level.Invocation) instead of Iteration
Browse files Browse the repository at this point in the history
In a "normal" JMH benchmark there are many invocations per iteration
but by default there is only one. We do need to kill the JVM after
every launch though, so, while it doesn't make any difference for the
default configuration, it's safer to use Level.Invocation.

See gh-7
  • Loading branch information
dsyer committed Apr 27, 2018
1 parent c028d1c commit 55ee5d2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flux/src/main/java/com/example/bench/MainBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public MainState() {
super("target", "--server.port=0");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
2 changes: 1 addition & 1 deletion flux/src/main/java/com/example/bench/MiniBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public MainState() {
super("target");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
2 changes: 1 addition & 1 deletion static/src/main/java/com/example/bench/CdsBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void customize(List<String> args) {
super.customize(args);
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
2 changes: 1 addition & 1 deletion static/src/main/java/com/example/bench/MainBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public MainState() {
super("target", "--server.port=0");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
2 changes: 1 addition & 1 deletion static/src/main/java/com/example/bench/OldBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public OldState() {
super("target", "--server.port=0");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
4 changes: 2 additions & 2 deletions static/src/main/java/com/example/bench/SnapBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public ApplicationState() {
super("target", "--server.port=0");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand All @@ -101,7 +101,7 @@ public EndpointState() {
super("target", "--server.port=0", "--endpoints.default.web.enabled=true");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down
2 changes: 1 addition & 1 deletion static/src/main/java/com/example/bench/StripBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public ApplicationState() {
super("target", "--server.port=0");
}

@TearDown(Level.Iteration)
@TearDown(Level.Invocation)
public void stop() throws Exception {
super.after();
}
Expand Down

0 comments on commit 55ee5d2

Please sign in to comment.