Commit b8054cb6 authored by Eric Bruneton's avatar Eric Bruneton
Browse files

Add ASM 9.0 to the benchmarks.

parent d51146fc
Pipeline #20796 passed with stage
in 5 minutes and 16 seconds
......@@ -54,6 +54,7 @@ public abstract class AbstractBenchmark {
private static final String ASM6_0 = BUILD_DIR + "asm6.0/";
private static final String ASM7_0 = BUILD_DIR + "asm7.0/";
private static final String ASM8_0 = BUILD_DIR + "asm8.0.1/";
private static final String ASM9_0 = BUILD_DIR + "asm9.0/";
// The directories where the Java 1.5 input data classes for the benchmarks can be found.
private static final String ASM_CORE_CURRENT = "/asm/build/classes/java/main/";
......@@ -86,6 +87,7 @@ public abstract class AbstractBenchmark {
V6_0,
V7_0,
V8_0,
V9_0,
V_CURRENT;
URL[] getUrls(final String baseUrl) throws MalformedURLException {
......@@ -100,6 +102,8 @@ public abstract class AbstractBenchmark {
return new URL[] {new URL(baseUrl + ASM7_0)};
case V8_0:
return new URL[] {new URL(baseUrl + ASM8_0)};
case V9_0:
return new URL[] {new URL(baseUrl + ASM9_0)};
case V_CURRENT:
return new URL[] {
new URL(baseUrl + ASM_CORE_CURRENT), new URL(baseUrl + ASM_TREE_CURRENT)
......
......@@ -54,6 +54,7 @@ public class AdapterBenchmark extends AbstractBenchmark {
private Adapter asm6dot0;
private Adapter asm7dot0;
private Adapter asm8dot0;
private Adapter asm9dot0;
private Adapter asmCurrent;
private Adapter aspectJBcel;
private Adapter bcel;
......@@ -77,6 +78,7 @@ public class AdapterBenchmark extends AbstractBenchmark {
asm6dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V6_0).newAsmBenchmark();
asm7dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V7_0).newAsmBenchmark();
asm8dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V8_0).newAsmBenchmark();
asm9dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V9_0).newAsmBenchmark();
asmCurrent = (Adapter) new AsmBenchmarkFactory(AsmVersion.V_CURRENT).newAsmBenchmark();
aspectJBcel = new AspectjBcelAdapter();
bcel = new BcelAdapter();
......@@ -89,7 +91,8 @@ public class AdapterBenchmark extends AbstractBenchmark {
|| !asm6dot0.getVersion().equals("ASM6")
|| !asm7dot0.getVersion().equals("ASM7")
|| !asm8dot0.getVersion().equals("ASM8")
|| !asmCurrent.getVersion().equals("ASM8")) {
|| !asm9dot0.getVersion().equals("ASM9")
|| !asmCurrent.getVersion().equals("ASM9")) {
throw new IllegalStateException();
}
......@@ -131,6 +134,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void getClassInfo_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.getClassInfo(classFile));
}
}
@Benchmark
public void getClassInfo_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -173,6 +183,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void getClassObjectModel_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.getClassObjectModel(classFile));
}
}
@Benchmark
public void getClassObjectModel_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -215,6 +232,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void read_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.read(classFile));
}
}
@Benchmark
public void read_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -257,6 +281,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWrite_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.readAndWrite(classFile, /* computeMaxs = */ false));
}
}
@Benchmark
public void readAndWrite_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -327,6 +358,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWriteWithComputeFrames_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.readAndWriteWithComputeFrames(classFile));
}
}
@Benchmark
public void readAndWriteWithComputeFrames_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -369,6 +407,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWriteWithComputeMaxs_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.readAndWrite(classFile, /* computeMaxs = */ true));
}
}
@Benchmark
public void readAndWriteWithComputeMaxs_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -432,6 +477,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWriteWithCopyPool_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.readAndWriteWithCopyPool(classFile));
}
}
@Benchmark
public void readAndWriteWithCopyPool_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......@@ -474,6 +526,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWriteWithObjectModel_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm9dot0.readAndWriteWithObjectModel(classFile));
}
}
@Benchmark
public void readAndWriteWithObjectModel_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......
......@@ -53,6 +53,7 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
private Adapter asm6dot0;
private Adapter asm7dot0;
private Adapter asm8dot0;
private Adapter asm9dot0;
private Adapter asmCurrent;
public AdapterBenchmarkJava8() {
......@@ -71,6 +72,7 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
asm6dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V6_0).newAsmBenchmark();
asm7dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V7_0).newAsmBenchmark();
asm8dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V8_0).newAsmBenchmark();
asm9dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V9_0).newAsmBenchmark();
asmCurrent = (Adapter) new AsmBenchmarkFactory(AsmVersion.V_CURRENT).newAsmBenchmark();
// Check that the correct versions of ASM have been loaded.
......@@ -78,7 +80,8 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
|| !asm6dot0.getVersion().equals("ASM6")
|| !asm7dot0.getVersion().equals("ASM7")
|| !asm8dot0.getVersion().equals("ASM8")
|| !asmCurrent.getVersion().equals("ASM8")) {
|| !asm9dot0.getVersion().equals("ASM9")
|| !asmCurrent.getVersion().equals("ASM9")) {
throw new IllegalStateException();
}
......@@ -113,6 +116,13 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
}
}
@Benchmark
public void getClassInfo_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
blackhole.consume(asm9dot0.getClassInfo(classFile));
}
}
@Benchmark
public void getClassInfo_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
......@@ -148,6 +158,13 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
}
}
@Benchmark
public void read_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
blackhole.consume(asm9dot0.read(classFile));
}
}
@Benchmark
public void read_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
......@@ -183,6 +200,13 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWrite_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
blackhole.consume(asm9dot0.readAndWrite(classFile, /* computeMaxs = */ false));
}
}
@Benchmark
public void readAndWrite_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
......@@ -218,6 +242,13 @@ public class AdapterBenchmarkJava8 extends AbstractBenchmark {
}
}
@Benchmark
public void readAndWriteWithCopyPool_asm9_0(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
blackhole.consume(asm9dot0.readAndWriteWithCopyPool(classFile));
}
}
@Benchmark
public void readAndWriteWithCopyPool_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : java8classFiles) {
......
......@@ -51,7 +51,7 @@ public class AsmAdapter extends Adapter {
@Override
public String getVersion() {
for (int i = 8; i >= 4; --i) {
for (int i = 9; i >= 4; --i) {
try {
String version = "ASM" + i;
if (Opcodes.class.getField(version) != null) {
......
......@@ -37,7 +37,7 @@ public class AsmFactory implements Factory {
@Override
public String getVersion() {
for (int i = 8; i >= 4; --i) {
for (int i = 9; i >= 4; --i) {
try {
String version = "ASM" + i;
if (Opcodes.class.getField(version) != null) {
......
......@@ -40,7 +40,7 @@ public class AsmGenerator extends Generator {
@Override
public String getVersion() {
for (int i = 8; i >= 5; --i) {
for (int i = 9; i >= 5; --i) {
try {
String version = "ASM" + i;
if (Opcodes.class.getField(version) != null) {
......
......@@ -52,6 +52,7 @@ public class GeneratorBenchmark extends AbstractBenchmark {
private Generator asm6dot0;
private Generator asm7dot0;
private Generator asm8dot0;
private Generator asm9dot0;
private Generator asmCurrent;
private Generator aspectJBcel;
private Generator bcel;
......@@ -77,6 +78,7 @@ public class GeneratorBenchmark extends AbstractBenchmark {
asm6dot0 = (Generator) new AsmBenchmarkFactory(AsmVersion.V6_0).newAsmBenchmark();
asm7dot0 = (Generator) new AsmBenchmarkFactory(AsmVersion.V7_0).newAsmBenchmark();
asm8dot0 = (Generator) new AsmBenchmarkFactory(AsmVersion.V8_0).newAsmBenchmark();
asm9dot0 = (Generator) new AsmBenchmarkFactory(AsmVersion.V9_0).newAsmBenchmark();
asmCurrent = (Generator) new AsmBenchmarkFactory(AsmVersion.V_CURRENT).newAsmBenchmark();
aspectJBcel = new AspectjBcelGenerator();
bcel = new BcelGenerator();
......@@ -92,7 +94,8 @@ public class GeneratorBenchmark extends AbstractBenchmark {
|| !asm6dot0.getVersion().equals("ASM6")
|| !asm7dot0.getVersion().equals("ASM7")
|| !asm8dot0.getVersion().equals("ASM8")
|| !asmCurrent.getVersion().equals("ASM8")) {
|| !asm9dot0.getVersion().equals("ASM9")
|| !asmCurrent.getVersion().equals("ASM9")) {
throw new IllegalStateException();
}
}
......@@ -117,6 +120,11 @@ public class GeneratorBenchmark extends AbstractBenchmark {
return asm8dot0.generateClass();
}
@Benchmark
public byte[] asm9_0() {
return asm9dot0.generateClass();
}
@Benchmark
public byte[] asmCurrent() {
return asmCurrent.generateClass();
......
......@@ -53,6 +53,7 @@ public class MemoryBenchmark extends AbstractBenchmark {
private Factory asm6dot0;
private Factory asm7dot0;
private Factory asm8dot0;
private Factory asm9dot0;
private Factory asmCurrent;
public MemoryBenchmark() {
......@@ -72,6 +73,7 @@ public class MemoryBenchmark extends AbstractBenchmark {
asm6dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V6_0).newAsmBenchmark();
asm7dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V7_0).newAsmBenchmark();
asm8dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V8_0).newAsmBenchmark();
asm9dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V9_0).newAsmBenchmark();
asmCurrent = (Factory) new AsmBenchmarkFactory(AsmVersion.V_CURRENT).newAsmBenchmark();
// Check that the correct versions of ASM have been loaded.
......@@ -80,7 +82,8 @@ public class MemoryBenchmark extends AbstractBenchmark {
|| !asm6dot0.getVersion().equals("ASM6")
|| !asm7dot0.getVersion().equals("ASM7")
|| !asm8dot0.getVersion().equals("ASM8")
|| !asmCurrent.getVersion().equals("ASM8")) {
|| !asm9dot0.getVersion().equals("ASM9")
|| !asmCurrent.getVersion().equals("ASM9")) {
throw new IllegalStateException();
}
......@@ -122,6 +125,13 @@ public class MemoryBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void newClass_asm9_0() {
for (byte[] classFile : classFiles) {
MemoryProfiler.keepReference(asm9dot0.newClass(classFile));
}
}
@Benchmark
public void newClass_asmCurrent() {
for (byte[] classFile : classFiles) {
......@@ -164,6 +174,13 @@ public class MemoryBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void newClassNode_asm9_0() {
for (byte[] classFile : classFiles) {
MemoryProfiler.keepReference(asm9dot0.newClassNode(classFile));
}
}
@Benchmark
public void newClassNode_asmCurrent() {
for (byte[] classFile : classFiles) {
......
......@@ -33,7 +33,7 @@ buildscript {
plugins { id 'biz.aQute.bnd.builder' version '6.2.0' apply false }
plugins { id 'com.github.sherter.google-java-format' version '0.9' apply false }
plugins { id 'me.champeau.gradle.jmh' version '0.5.3' apply false }
plugins { id 'me.champeau.jmh' version '0.6.6' apply false }
plugins { id 'org.sonarqube' version '3.3' apply false }
description = 'ASM, a very small and fast Java bytecode manipulation framework'
......@@ -112,7 +112,7 @@ project(':asm-util') {
// Use "gradle benchmarks:jmh [-PjmhInclude='<regex>']" to run the benchmarks.
project(':benchmarks') {
description = "Benchmarks for ${rootProject.description}"
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'me.champeau.jmh'
dependencies {
implementation files('libs/csg-bytecode-1.0.0.jar', 'libs/jclasslib.jar')
jmh project(':asm'), project(':asm-tree')
......@@ -127,7 +127,7 @@ project(':benchmarks') {
'org.javassist:javassist:3.21.0-GA',
'org.mozilla:rhino:1.7.7.1'
]
['4.0', '5.0.1', '6.0', '7.0', '8.0.1'].each { version ->
['4.0', '5.0.1', '6.0', '7.0', '8.0.1', '9.0'].each { version ->
configurations.create("asm${version}")
dependencies.add("asm${version}", "org.ow2.asm:asm:${version}@jar")
dependencies.add("asm${version}", "org.ow2.asm:asm-tree:${version}@jar")
......@@ -146,7 +146,7 @@ project(':benchmarks') {
}
classes.dependsOn copyInputClasses
jmh {
jvmArgsAppend = "-Duser.dir=${rootDir}"
jvmArgsAppend = ["-Duser.dir=${rootDir}"]
resultFormat = 'CSV'
profilers = ['org.objectweb.asm.benchmarks.MemoryProfiler']
if (rootProject.hasProperty('jmhInclude')) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment