for (int i = 0; i < 10; ++i) {
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size(); ++j) {
byte[] b = (byte[]) classes.get(j);
new ClassReader(b).accept(new ClassNode(), 0);
}
t = System.currentTimeMillis() - t;
times[9] = Math.min(t, times[9]);
System.out.println("Time to deserialize " + classes.size()
+ " classes with tree package = " + t + " ms");
}
for (int i = 0; i < 10; ++i) {
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size(); ++j) {
byte[] b = (byte[]) classes.get(j);
ClassWriter cw = new ClassWriter(0);
ClassNode cn = new ClassNode();
new ClassReader(b).accept(cn, 0);
cn.accept(cw);
cw.toByteArray();
}
t = System.currentTimeMillis() - t;
times[10] = Math.min(t, times[10]);
System.out.println("Time to deserialize and reserialize "
+ classes.size() + " classes with tree package = " + t
+ " ms");
}
for (int i = 0; i < 10; ++i) {
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size(); ++j) {
byte[] b = (byte[]) classes.get(j);
ClassWriter cw = new ClassWriter(0);
ClassNode cn = new ClassNode();
new ClassReader(b).accept(cn, 0);
new AddTimerTransformer(null).transform(cn);
cn.accept(cw);
cw.toByteArray();
}
t = System.currentTimeMillis() - t;
times[11] = Math.min(t, times[11]);
System.out.println("Time to deserialize and reserialize "
+ classes.size() + " classes with AddTimerTransformer = " + t
+ " ms");
}
for (int i = 0; i < 10; ++i) {
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size(); ++j) {
byte[] b = (byte[]) classes.get(j);
ClassWriter cw = new ClassWriter(0);
ClassNode cn = new ClassNode();
new ClassReader(b).accept(cn, 0);
Iterator it = cn.methods.iterator();
while (it.hasNext()) {
MethodNode mn = (MethodNode) it.next();
new RemoveGetFieldPutFieldTransformer(null).transform(mn);
}
cn.accept(cw);
cw.toByteArray();
}
t = System.currentTimeMillis() - t;
times[12] = Math.min(t, times[12]);
System.out.println("Time to deserialize and reserialize "
+ classes.size()
+ " classes with RemoveGetFieldPutFieldTransformer = " + t
+ " ms");
}
for (int i = 0; i < 10; ++i) {
int errors = 0;
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size() / 10; ++j) {
byte[] b = (byte[]) classes.get(j);
ClassReader cr = new ClassReader(b);
ClassNode cn = new ClassNode();
cr.accept(cn, 0);
List methods = cn.methods;
for (int k = 0; k < methods.size(); ++k) {
MethodNode method = (MethodNode) methods.get(k);
if (method.instructions.size() > 0) {
Analyzer a = new Analyzer(new BasicInterpreter());
try {
a.analyze(cn.name, method);
} catch (Throwable th) {
++errors;
}
}
}
}
t = System.currentTimeMillis() - t;
times[13] = Math.min(t, times[13]);
System.out.println("Time to analyze " + classes.size() / 10
+ " classes with BasicInterpreter = " + t + " ms (" + errors
+ " errors)");
}
for (int i = 0; i < 10; ++i) {
int errors = 0;
long t = System.currentTimeMillis();
for (int j = 0; j < classes.size() / 10; ++j) {
byte[] b = (byte[]) classes.get(j);
ClassReader cr = new ClassReader(b);
ClassNode cn = new ClassNode();
cr.accept(cn, 0);
List methods = cn.methods;
for (int k = 0; k < methods.size(); ++k) {
MethodNode method = (MethodNode) methods.get(k);
if (method.instructions.size() > 0) {