From 1cea85e49ae7659e7124383b619730ba6053bb46 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 4 Sep 2014 14:30:28 +0400 Subject: java-decompiler: optimization (less string buffer allocations on generating text) --- src/org/jetbrains/java/decompiler/util/InterpreterUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/org/jetbrains/java/decompiler/util/InterpreterUtil.java') diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java index cc4e4bd..5f48e32 100644 --- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java +++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java @@ -60,12 +60,16 @@ public class InterpreterUtil { } public static String getIndentString(int length) { - String indent = (String)DecompilerContext.getProperty(IFernflowerPreferences.INDENT_STRING); StringBuilder buf = new StringBuilder(); + appendIndent(buf, length); + return buf.toString(); + } + + public static void appendIndent(StringBuilder buffer, int length) { + String indent = (String)DecompilerContext.getProperty(IFernflowerPreferences.INDENT_STRING); while (length-- > 0) { - buf.append(indent); + buffer.append(indent); } - return buf.toString(); } public static boolean equalSets(Collection c1, Collection c2) { -- cgit v1.2.3