summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-04-10 21:27:54 -0700
committerShawn Pearce <sop@google.com>2013-04-11 01:17:28 -0700
commit1db50c9d91adaadc019938eaaa7e91e3963fb681 (patch)
tree9afa14867a636ac2152b9c4d923be802855ca959 /org.eclipse.jgit
parent6903fa4a3447d74cf76f5bc661da0af46d5691ff (diff)
downloadjgit-1db50c9d91adaadc019938eaaa7e91e3963fb681.tar.gz
jgit-1db50c9d91adaadc019938eaaa7e91e3963fb681.zip
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
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java
index 298be02cc7..3ff0a6c1cb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java
@@ -57,9 +57,8 @@ import org.eclipse.jgit.storage.pack.PackConfig;
import org.eclipse.jgit.util.TemporaryBuffer;
final class DeltaWindow {
- private static final int NEXT_RES = 0;
-
- private static final int NEXT_SRC = 1;
+ private static final boolean NEXT_RES = false;
+ private static final boolean NEXT_SRC = true;
private final PackConfig config;
private final DeltaCache deltaCache;
@@ -236,10 +235,10 @@ final class DeltaWindow {
DeltaWindowEntry src = window[srcSlot];
if (src.empty())
break;
- if (delta(src, srcSlot) == NEXT_RES) {
- bestDelta = null;
- return;
- }
+ if (delta(src, srcSlot) /* == NEXT_SRC */)
+ continue;
+ bestDelta = null;
+ return;
}
// We couldn't find a suitable delta for this object, but it may
@@ -286,7 +285,7 @@ final class DeltaWindow {
keepInWindow();
}
- private int delta(final DeltaWindowEntry src, final int srcSlot)
+ private boolean delta(final DeltaWindowEntry src, final int srcSlot)
throws IOException {
// Objects must use only the same type as their delta base.
// If we are looking at something where that isn't true we