JMH support for JVM languages
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Mar 4 07:35:41 PST 2014
Hi there,
Currently, you can run non-Java benchmarks only if you do the
JMH-annotated Java trampolines which will then call into the non-Java
code you want. You can also possibly do the reflective/MH call into the
compiled non-Java classes. Both ways are rather messy.
If you track the commit history closely, you might have noticed we were
working on getting the native support for JVM languages in JMH. This is
a call for testing and feedback.
In order to ease the testing, and also following The Rule of Three, we
have committed three sample archetypes for running Scala, Groovy, and
Kotlin benchmarks (that was a semi-random choice out of existing
non-Java languages pool).
We would like early testers to:
a) Hack and try out the non-Java language benchmarks to see if JMH
supports everything it supports for Java benchmarks.
b) Review the compilation sequence code outlined in sample POMs for
three existing language bindings.
c) Suggest the code for compiling another non-Java language.
d) Report on quirks, glitches, and things to improve.
Build and test instructions:
1) Check out the bleeding edge JMH:
$ hg clone http://hg.openjdk.java.net/code-tools/jmh/ jmh
$ cd jmh/
2) Build it. Note the additional target, which will deploy the
archetypes on your local filesystem:
$ mvn clean install archetype:update-local-catalog -DskipTests
3) Call the archetype to generate the sample project for you. Change
"scala" to something else to use another archetype ("scala", "groovy",
"kotlin" are supported now):
$ cd /tmp
$ mvn archetype:generate \
-DinteractiveMode=false \
-DarchetypeGroupId=org.openjdk.jmh \
-DarchetypeArtifactId=jmh-scala-benchmark-archetype \
-DgroupId=org.sample \
-DartifactId=test \
-Dversion=1.0 \
-DarchetypeCatalog=local
4) Build the generated project:
$ cd test/
$ mvn clean install.
5) Hack, hack, hack!
Thanks,
-Aleksey.
More information about the jmh-dev
mailing list