Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

move from @GenerateMicroBenchmark to @Benchmark #1

Merged
merged 3 commits into from

2 participants

@n0mer

update to jmh v0.9:

  • switch from @GenerateMicroBenchmark to @Benchmark
  • proper package for Result and RunResult classes (w/out "logic" intermediate)
@RichardWarburton

Happy to bump to v0.9 and @Benchmark but this doesn't seem to change the pom.xml to a release. Is that right?

@n0mer

@RichardWarburton you've been using snapshot dependency, so this is up to you.
I prefer to specify exact version, so please review follow-up comits.

@RichardWarburton

I only originally started using a snapshot version in order to bring in a bug fix which wasn't in a public release, now 0.9 is out its great that you've put that in the pom!

Thanks for the pull request, merging now.

@RichardWarburton RichardWarburton merged commit 0d5cebc into from
@n0mer

thank you as well for open-sourcing the code!

by the way i found your articles here http://www.javacodegeeks.com/author/richard-warburton/ - thanks for publishing your insights and findings, very informative.

One more contribution: recently found nice article from atlassian on how to use Git (especually this "pull request" functionality) here: https://www.atlassian.com/git/workflows Good link to recommend to your readers when you state that code is on GitHub. I learned how to do "pull requests" and how to deal with forked repositoried from atlassian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 pom.xml
@@ -13,12 +13,12 @@
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>0.9</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>0.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
View
44 src/main/java/com/insightfullogic/java_final_benchmarks/JavaFinalBenchmark.java
@@ -32,22 +32,22 @@ public void setup() {
inlinableTarget = new InlinableTargetClass1();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void virtualInvoke() {
target.targetVirtual();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void finalInvoke() {
target.targetFinal();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void inlinableVirtualInvoke() {
inlinableTarget.targetVirtual();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void inlinableFinalInvoke() {
inlinableTarget.targetFinal();
}
@@ -59,92 +59,92 @@ public void inlinableFinalInvoke() {
* Numbers refer to how far up the class hierarchy the inherited method is from
*/
- @GenerateMicroBenchmark
+ @Benchmark
public void parentMethod1() {
target.inheritedTarget1();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentMethod2() {
target.inheritedTarget2();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentMethod3() {
target.inheritedTarget3();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentMethod4() {
target.inheritedTarget4();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentFinalMethod1() {
target.inheritedFinalTarget1();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentFinalMethod2() {
target.inheritedFinalTarget2();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentFinalMethod3() {
target.inheritedFinalTarget3();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void parentFinalMethod4() {
target.inheritedFinalTarget4();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void alwaysOverriddenMethod() {
target.alwaysOverriddenTarget();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentMethod1() {
return inlinableTarget.inheritedTarget1();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentMethod2() {
return inlinableTarget.inheritedTarget2();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentMethod3() {
return inlinableTarget.inheritedTarget3();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentMethod4() {
return inlinableTarget.inheritedTarget4();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentFinalMethod1() {
return inlinableTarget.inheritedFinalTarget1();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentFinalMethod2() {
return inlinableTarget.inheritedFinalTarget2();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentFinalMethod3() {
return inlinableTarget.inheritedFinalTarget3();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableParentFinalMethod4() {
return inlinableTarget.inheritedFinalTarget4();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableAlwaysOverriddenMethod() {
return inlinableTarget.alwaysOverriddenTarget();
}
View
28 src/main/java/com/insightfullogic/java_final_benchmarks/PolymorphicBenchmark.java
@@ -1,8 +1,8 @@
package com.insightfullogic.java_final_benchmarks;
import org.openjdk.jmh.annotations.*;
-import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.logic.results.RunResult;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;
@@ -45,35 +45,35 @@ public void setup() {
inlinableChildB = new InlinableOverridingClassB();
}
- @GenerateMicroBenchmark
+ @Benchmark
public void monomorphicInvoke_warmup() {
invoke(polymorph);
}
- @GenerateMicroBenchmark
+ @Benchmark
public void monomorphicInvoke_measure() {
invoke(polymorph);
}
- @GenerateMicroBenchmark
+ @Benchmark
public void bimorphicInvoke_warmup() {
invoke(childA);
invoke(childB);
}
- @GenerateMicroBenchmark
+ @Benchmark
public void bimorphicInvoke_measure() {
invoke(childA);
}
- @GenerateMicroBenchmark
+ @Benchmark
public void megamorphicInvoke_warmup() {
invoke(polymorph);
invoke(childA);
invoke(childB);
}
- @GenerateMicroBenchmark
+ @Benchmark
public void megamorphicInvoke_measure() {
invoke(childA);
}
@@ -83,35 +83,35 @@ private void invoke(Polymorph polymorph) {
polymorph.polymorphicMethod();
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableMonomorphicInvoke_warmup() {
return inlinableInvoke(inlinablePolymorph);
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableMonomorphicInvoke_measure() {
return inlinableInvoke(inlinablePolymorph);
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableBimorphicInvoke_warmup() {
return inlinableInvoke(inlinableChildA)
+ inlinableInvoke(inlinableChildB);
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableBimorphicInvoke_measure() {
return inlinableInvoke(inlinableChildA);
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableMegamorphicInvoke_warmup() {
return inlinableInvoke(inlinablePolymorph)
+ inlinableInvoke(inlinableChildA)
+ inlinableInvoke(inlinableChildB);
}
- @GenerateMicroBenchmark
+ @Benchmark
public double inlinableMegamorphicInvoke_measure() {
return inlinableInvoke(inlinableChildA);
}
Something went wrong with that request. Please try again.