Micro-optimize DeltaWindow primary loop
javac and the JIT are more likely to understand a boolean being used as a branch conditional than comparing int against 0 and 1. Rewrite NEXT_RES and NEXT_SRC constants to be booleans so the code is clarified for the JIT. Change-Id: I1bdd8b587a69572975a84609c779b9ebf877b85d
This commit is contained in:
parent
6903fa4a34
commit
1db50c9d91
|
@ -57,9 +57,8 @@
|
||||||
import org.eclipse.jgit.util.TemporaryBuffer;
|
import org.eclipse.jgit.util.TemporaryBuffer;
|
||||||
|
|
||||||
final class DeltaWindow {
|
final class DeltaWindow {
|
||||||
private static final int NEXT_RES = 0;
|
private static final boolean NEXT_RES = false;
|
||||||
|
private static final boolean NEXT_SRC = true;
|
||||||
private static final int NEXT_SRC = 1;
|
|
||||||
|
|
||||||
private final PackConfig config;
|
private final PackConfig config;
|
||||||
private final DeltaCache deltaCache;
|
private final DeltaCache deltaCache;
|
||||||
|
@ -236,11 +235,11 @@ private void searchInWindow() throws IOException {
|
||||||
DeltaWindowEntry src = window[srcSlot];
|
DeltaWindowEntry src = window[srcSlot];
|
||||||
if (src.empty())
|
if (src.empty())
|
||||||
break;
|
break;
|
||||||
if (delta(src, srcSlot) == NEXT_RES) {
|
if (delta(src, srcSlot) /* == NEXT_SRC */)
|
||||||
|
continue;
|
||||||
bestDelta = null;
|
bestDelta = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// We couldn't find a suitable delta for this object, but it may
|
// We couldn't find a suitable delta for this object, but it may
|
||||||
// still be able to act as a base for another one.
|
// still be able to act as a base for another one.
|
||||||
|
@ -286,7 +285,7 @@ private void searchInWindow() throws IOException {
|
||||||
keepInWindow();
|
keepInWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int delta(final DeltaWindowEntry src, final int srcSlot)
|
private boolean delta(final DeltaWindowEntry src, final int srcSlot)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// Objects must use only the same type as their delta base.
|
// Objects must use only the same type as their delta base.
|
||||||
// If we are looking at something where that isn't true we
|
// If we are looking at something where that isn't true we
|
||||||
|
|
Loading…
Reference in New Issue