diff options
author | Andrey Loskutov <loskutov@gmx.de> | 2015-10-28 20:52:43 +0100 |
---|---|---|
committer | Andrey Loskutov <loskutov@gmx.de> | 2015-10-28 20:52:43 +0100 |
commit | 260e092e7966e15a8778af1d5e6bec89689f7377 (patch) | |
tree | 6f76cc160aa516df6103de2ecd8162cac6dd97ea /org.eclipse.jgit/src/org/eclipse/jgit/util | |
parent | df876d2e0f4a3d4b99249ae03f901adcb9175c36 (diff) | |
download | jgit-260e092e7966e15a8778af1d5e6bec89689f7377.tar.gz jgit-260e092e7966e15a8778af1d5e6bec89689f7377.zip |
[performance] Remove synthetic access$ methods in lib, util and dircache
Java compiler must generate synthetic access methods for private methods
and fields of the enclosing class if they are accessed from inner
classes and vice versa.
While invisible in the code, those synthetic access methods exist in the
bytecode and seem to produce some extra execution overhead at runtime
(compared with the direct access to this fields or methods), see
https://git.eclipse.org/r/58948/.
By removing the "private" access modifier from affected methods and
fields we help compiler to avoid generation of synthetic access methods
and hope to improve execution performance.
To validate changes, one can either use javap or use Bytecode Outline
plugin in Eclipse. In both cases one should look for "synthetic
access$<number>" methods at the end of the class and inner class files
in question - there should be none.
NB: don't mix this "synthetic access$" methods up with "public synthetic
bridge" methods generated to allow generic method override return types.
Change-Id: Ie7b65f251ec4452d5a5ed48aa0f272cf49a9aecd
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util')
5 files changed, 17 insertions, 17 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/BlockList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/BlockList.java index 0454e7e0d9..9d0ad736fa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/BlockList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/BlockList.java @@ -74,9 +74,9 @@ public class BlockList<T> extends AbstractList<T> { private static final int BLOCK_MASK = BLOCK_SIZE - 1; - private T[][] directory; + T[][] directory; - private int size; + int size; private int tailDirIdx; @@ -282,11 +282,11 @@ public class BlockList<T> extends AbstractList<T> { return new MyIterator(); } - private static final int toDirectoryIndex(int index) { + static final int toDirectoryIndex(int index) { return index >>> BLOCK_BITS; } - private static final int toBlockIndex(int index) { + static final int toBlockIndex(int index) { return index & BLOCK_MASK; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index e5219b2a92..d860d8ac72 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -110,7 +110,7 @@ public abstract class FS { } } - private final static Logger LOG = LoggerFactory.getLogger(FS.class); + final static Logger LOG = LoggerFactory.getLogger(FS.class); /** The auto-detected implementation selected for this operating system and JRE. */ public static final FS DETECTED = detect(); @@ -490,9 +490,9 @@ public abstract class FS { private final String desc; private final String dir; private final boolean debug = LOG.isDebugEnabled(); - private final AtomicBoolean fail = new AtomicBoolean(); + final AtomicBoolean fail = new AtomicBoolean(); - private GobblerThread(Process p, String[] command, File dir) { + GobblerThread(Process p, String[] command, File dir) { this.p = p; if (debug) { this.desc = Arrays.asList(command).toString(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java index 4695111de9..0853e95366 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java @@ -80,9 +80,9 @@ public class RefList<T extends Ref> implements Iterable<Ref> { return (RefList<T>) EMPTY; } - private final Ref[] list; + final Ref[] list; - private final int cnt; + final int cnt; RefList(Ref[] list, int cnt) { this.list = list; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java index 5cc7e92c52..c72727b542 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java @@ -78,10 +78,10 @@ public class RefMap extends AbstractMap<String, Ref> { * All reference names in this map must start with this prefix. If the * prefix is not the empty string, it must end with a '/'. */ - private final String prefix; + final String prefix; /** Immutable collection of the packed references at construction time. */ - private RefList<Ref> packed; + RefList<Ref> packed; /** * Immutable collection of the loose references at construction time. @@ -91,7 +91,7 @@ public class RefMap extends AbstractMap<String, Ref> { * are typically unresolved, so they only tell us who their target is, but * not the current value of the target. */ - private RefList<Ref> loose; + RefList<Ref> loose; /** * Immutable collection of resolved symbolic references. @@ -101,11 +101,11 @@ public class RefMap extends AbstractMap<String, Ref> { * from {@link #loose}. Every entry in this list must be matched by an entry * in {@code loose}, otherwise it might be omitted by the map. */ - private RefList<Ref> resolved; + RefList<Ref> resolved; - private int size; + int size; - private boolean sizeIsValid; + boolean sizeIsValid; private Set<Entry<String, Ref>> entrySet; @@ -280,7 +280,7 @@ public class RefMap extends AbstractMap<String, Ref> { return name; } - private String toMapKey(Ref ref) { + String toMapKey(Ref ref) { String name = ref.getName(); if (0 < prefix.length()) name = name.substring(prefix.length()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java index e2738c03f9..ca47f50fd9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java @@ -69,7 +69,7 @@ public abstract class TemporaryBuffer extends OutputStream { protected static final int DEFAULT_IN_CORE_LIMIT = 1024 * 1024; /** Chain of data, if we are still completely in-core; otherwise null. */ - private ArrayList<Block> blocks; + ArrayList<Block> blocks; /** * Maximum number of bytes we will permit storing in memory. |