Commit 2cc74e39 authored by Eric Bruneton's avatar Eric Bruneton

Add benchmarks for ASM 7.0.

parent a71e8e13
Pipeline #3220 passed with stage
in 9 minutes and 13 seconds
......@@ -54,6 +54,7 @@ public abstract class AbstractBenchmark {
private static final String ASM6_0 = BUILD_DIR + "asm6.0/";
private static final String ASM6_1 = BUILD_DIR + "asm6.1.1/";
private static final String ASM6_2 = BUILD_DIR + "asm6.2.1/";
private static final String ASM7_0 = BUILD_DIR + "asm7.0/";
private static final String ASM_CORE_CURRENT = "/asm/build/classes/java/main/";
private static final String ASM_TREE_CURRENT = "/asm-tree/build/classes/java/main/";
......@@ -69,6 +70,7 @@ public abstract class AbstractBenchmark {
V6_0,
V6_1,
V6_2,
V7_0,
V_CURRENT;
URL[] getUrls(final String baseUrl) throws MalformedURLException {
......@@ -83,6 +85,8 @@ public abstract class AbstractBenchmark {
return new URL[] {new URL(baseUrl + ASM6_1)};
case V6_2:
return new URL[] {new URL(baseUrl + ASM6_2)};
case V7_0:
return new URL[] {new URL(baseUrl + ASM7_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 asm6dot1;
private Adapter asm6dot2;
private Adapter asm7dot0;
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();
asm6dot1 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V6_1).newAsmBenchmark();
asm6dot2 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V6_2).newAsmBenchmark();
asm7dot0 = (Adapter) new AsmBenchmarkFactory(AsmVersion.V7_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")
|| !asm6dot1.getVersion().equals("ASM6")
|| !asm6dot2.getVersion().equals("ASM6")
|| !asmCurrent.getVersion().equals("ASM6")) {
|| !asm7dot0.getVersion().equals("ASM7")
|| !asmCurrent.getVersion().equals("ASM7")) {
throw new IllegalStateException();
}
......@@ -131,6 +134,13 @@ public class AdapterBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void getClassInfo_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.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_asm7_0(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
blackhole.consume(asm7dot0.readAndWriteWithObjectModel(classFile));
}
}
@Benchmark
public void readAndWriteWithObjectModel_asmCurrent(final Blackhole blackhole) {
for (byte[] classFile : classFiles) {
......
......@@ -51,7 +51,7 @@ public class AsmAdapter extends Adapter {
@Override
public String getVersion() {
for (int i = 6; i >= 4; --i) {
for (int i = 7; 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 = 6; i >= 4; --i) {
for (int i = 7; 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 = 6; i >= 4; --i) {
for (int i = 7; i >= 4; --i) {
try {
String version = "ASM" + i;
if (Opcodes.class.getField(version) != null) {
......
......@@ -53,6 +53,7 @@ public class MemoryBenchmark extends AbstractBenchmark {
private Factory asm6dot0;
private Factory asm6dot1;
private Factory asm6dot2;
private Factory asm7dot0;
private Factory asmCurrent;
public MemoryBenchmark() {
......@@ -72,6 +73,7 @@ public class MemoryBenchmark extends AbstractBenchmark {
asm6dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V6_0).newAsmBenchmark();
asm6dot1 = (Factory) new AsmBenchmarkFactory(AsmVersion.V6_1).newAsmBenchmark();
asm6dot2 = (Factory) new AsmBenchmarkFactory(AsmVersion.V6_2).newAsmBenchmark();
asm7dot0 = (Factory) new AsmBenchmarkFactory(AsmVersion.V7_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")
|| !asm6dot1.getVersion().equals("ASM6")
|| !asm6dot2.getVersion().equals("ASM6")
|| !asmCurrent.getVersion().equals("ASM6")) {
|| !asm7dot0.getVersion().equals("ASM7")
|| !asmCurrent.getVersion().equals("ASM7")) {
throw new IllegalStateException();
}
......@@ -122,6 +125,13 @@ public class MemoryBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void newClass_asm7_0() {
for (byte[] classFile : classFiles) {
MemoryProfiler.keepReference(asm7dot0.newClass(classFile));
}
}
@Benchmark
public void newClass_asmCurrent() {
for (byte[] classFile : classFiles) {
......@@ -164,6 +174,13 @@ public class MemoryBenchmark extends AbstractBenchmark {
}
}
@Benchmark
public void newClassNode_asm7_0() {
for (byte[] classFile : classFiles) {
MemoryProfiler.keepReference(asm7dot0.newClassNode(classFile));
}
}
@Benchmark
public void newClassNode_asmCurrent() {
for (byte[] classFile : classFiles) {
......
......@@ -122,7 +122,7 @@ project(':benchmarks') {
'org.javassist:javassist:3.21.0-GA',
'org.mozilla:rhino:1.7.7.1'
]
['4.0', '5.0.1', '6.0', '6.1.1', '6.2.1'].each { version ->
['4.0', '5.0.1', '6.0', '6.1.1', '6.2.1', '7.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")
......
Markdown is supported
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