[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>
This commit is contained in:
parent
df876d2e0f
commit
260e092e79
|
@ -103,7 +103,7 @@ public int compare(final DirCacheTree o1, final DirCacheTree o2) {
|
|||
private DirCacheTree parent;
|
||||
|
||||
/** Name of this tree within its parent. */
|
||||
private byte[] encodedName;
|
||||
byte[] encodedName;
|
||||
|
||||
/** Number of {@link DirCacheEntry} records that belong to this tree. */
|
||||
private int entrySpan;
|
||||
|
|
|
@ -83,16 +83,16 @@ public class ObjectIdOwnerMap<V extends ObjectIdOwnerMap.Entry> implements
|
|||
* The low {@link #bits} of the SHA-1 are used to select the segment from
|
||||
* this directory. Each segment is constant sized at 2^SEGMENT_BITS.
|
||||
*/
|
||||
private V[][] directory;
|
||||
V[][] directory;
|
||||
|
||||
/** Total number of objects in this map. */
|
||||
private int size;
|
||||
int size;
|
||||
|
||||
/** The map doubles in capacity when {@link #size} reaches this target. */
|
||||
private int grow;
|
||||
|
||||
/** Number of low bits used to form the index into {@link #directory}. */
|
||||
private int bits;
|
||||
int bits;
|
||||
|
||||
/** Low bit mask to index into {@link #directory}, {@code 2^bits-1}. */
|
||||
private int mask;
|
||||
|
|
|
@ -63,13 +63,13 @@
|
|||
public class ObjectIdSubclassMap<V extends ObjectId> implements Iterable<V> {
|
||||
private static final int INITIAL_TABLE_SIZE = 2048;
|
||||
|
||||
private int size;
|
||||
int size;
|
||||
|
||||
private int grow;
|
||||
|
||||
private int mask;
|
||||
|
||||
private V[] table;
|
||||
V[] table;
|
||||
|
||||
/** Create an empty map. */
|
||||
public ObjectIdSubclassMap() {
|
||||
|
|
|
@ -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 Iterator<T> iterator() {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public FS detect(Boolean cygwinUsed) {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ private static class GobblerThread extends Thread {
|
|||
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();
|
||||
|
|
|
@ -80,9 +80,9 @@ public static <T extends Ref> RefList<T> emptyList() {
|
|||
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;
|
||||
|
|
|
@ -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 @@ private String toRefName(String name) {
|
|||
return name;
|
||||
}
|
||||
|
||||
private String toMapKey(Ref ref) {
|
||||
String toMapKey(Ref ref) {
|
||||
String name = ref.getName();
|
||||
if (0 < prefix.length())
|
||||
name = name.substring(prefix.length());
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue