java-decompiler: minor optimization

master
Roman Shevchenko 10 years ago
parent 18a9c2851b
commit 8462998a86
  1. 4
      src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
  2. 2
      src/org/jetbrains/java/decompiler/main/Fernflower.java

@ -41,6 +41,8 @@ import java.util.Map.Entry;
public class ClassesProcessor { public class ClassesProcessor {
public static final int AVERAGE_CLASS_SIZE = 16 * 1024;
private Map<String, ClassNode> mapRootClasses = new HashMap<String, ClassNode>(); private Map<String, ClassNode> mapRootClasses = new HashMap<String, ClassNode>();
public ClassesProcessor(StructContext context) { public ClassesProcessor(StructContext context) {
@ -258,7 +260,7 @@ public class ClassesProcessor {
new NestedMemberAccess().propagateMemberAccess(root); new NestedMemberAccess().propagateMemberAccess(root);
StringBuilder classBuffer = new StringBuilder(); StringBuilder classBuffer = new StringBuilder(AVERAGE_CLASS_SIZE);
new ClassWriter().classToJava(root, classBuffer, 0); new ClassWriter().classToJava(root, classBuffer, 0);
String lineSeparator = DecompilerContext.getNewLineSeparator(); String lineSeparator = DecompilerContext.getNewLineSeparator();

@ -82,7 +82,7 @@ public class Fernflower implements IDecompiledData {
@Override @Override
public String getClassContent(StructClass cl) { public String getClassContent(StructClass cl) {
try { try {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder(ClassesProcessor.AVERAGE_CLASS_SIZE);
classesProcessor.writeClass(cl, buffer); classesProcessor.writeClass(cl, buffer);
return buffer.toString(); return buffer.toString();
} }

Loading…
Cancel
Save