Micro-optimize AbstractTreeIterator.pathCompare
commitf66d3c283c03fc34f0a16994385a1b5e98e11104
authorShawn O. Pearce <spearce@spearce.org>
Mon, 18 Aug 2008 23:53:15 +0000 (18 16:53 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 20 Aug 2008 21:07:32 +0000 (20 23:07 +0200)
tree5c1d48727518bbf5e5747433871e3a0eaea26b5a
parent4a91b92f1314a4219c465ed6166986afe65b1ff7
Micro-optimize AbstractTreeIterator.pathCompare

We were doing far too much work in pathCompare to handle
cases that just cannot ever happen, such as if the paths
were the same length but had different "last path char"
and then somehow had different lengths.

We also had the JVM doing a lot of comparsion ops just
to return -1/0/1 when really we can get away with the
non-zero result returned to the caller.  Issuing just
the subtraction and one comparsion to 0 is much quicker,
JIT or not.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/treewalk/AbstractTreeIterator.java