summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/util
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-06 17:26:24 +0200
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-06 17:26:24 +0200
commitbef17b44fce71dfce6345f19695949eb4432e25d (patch)
tree45f65e5da978d7180c1b190ce816400882b07592 /src/org/jetbrains/java/decompiler/util
parent8462998a86033277557a49b85f9720e21ae70dcb (diff)
downloadfernflower-bef17b44fce71dfce6345f19695949eb4432e25d.tar
fernflower-bef17b44fce71dfce6345f19695949eb4432e25d.tar.gz
fernflower-bef17b44fce71dfce6345f19695949eb4432e25d.tar.lz
fernflower-bef17b44fce71dfce6345f19695949eb4432e25d.tar.xz
fernflower-bef17b44fce71dfce6345f19695949eb4432e25d.zip
java-decompiler: minor optimization (no more empty array creation)
Diffstat (limited to 'src/org/jetbrains/java/decompiler/util')
-rw-r--r--src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java1
-rw-r--r--src/org/jetbrains/java/decompiler/util/InterpreterUtil.java2
-rw-r--r--src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java8
3 files changed, 7 insertions, 4 deletions
diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java
index bf01035..64e98a0 100644
--- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java
+++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java
@@ -88,6 +88,7 @@ public class FastSparseSetFactory<E> {
public static class FastSparseSet<E> implements Iterable<E> {
+ public static final FastSparseSet[] EMPTY_ARRAY = new FastSparseSet[0];
private FastSparseSetFactory<E> factory;
diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
index 09e7bad..eaada90 100644
--- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
+++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java
@@ -29,6 +29,8 @@ import java.util.zip.ZipFile;
public class InterpreterUtil {
public static final boolean IS_WINDOWS = System.getProperty("os.name", "").startsWith("Windows");
+ public static final int[] EMPTY_INT_ARRAY = new int[0];
+
private static final int CHANNEL_WINDOW_SIZE = IS_WINDOWS ? 64 * 1024 * 1024 - (32 * 1024) : 64 * 1024 * 1024; // magic number for Windows
private static final int BUFFER_SIZE = 16 * 1024;
diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java
index 996607a..b70dede 100644
--- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java
+++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java
@@ -38,9 +38,9 @@ public class SFormsFastMapDirect {
private SFormsFastMapDirect(boolean initialize) {
if (initialize) {
for (int i = 2; i >= 0; i--) {
- @SuppressWarnings("unchecked") FastSparseSet<Integer>[] empty = new FastSparseSet[0];
+ @SuppressWarnings("unchecked") FastSparseSet<Integer>[] empty = FastSparseSet.EMPTY_ARRAY;
elements[i] = empty;
- next[i] = new int[0];
+ next[i] = InterpreterUtil.EMPTY_INT_ARRAY;
}
}
}
@@ -99,8 +99,8 @@ public class SFormsFastMapDirect {
while (pointer != 0);
}
else {
- mapelements[i] = new FastSparseSet[0];
- mapnext[i] = new int[0];
+ mapelements[i] = FastSparseSet.EMPTY_ARRAY;
+ mapnext[i] = InterpreterUtil.EMPTY_INT_ARRAY;
}
}