Removed use of System.identityHashCode from critical loops.
commit9f75ae66135c8a8c787764bd1cf9011890037e4b
authorShawn O. Pearce <spearce@spearce.org>
Thu, 30 Nov 2006 07:04:45 +0000 (30 02:04 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 30 Nov 2006 07:04:45 +0000 (30 02:04 -0500)
treef40699a2879d820d99674397d367759ffc992efa
parent6c127ab5290700af859fa1d6df204df96c281f80
Removed use of System.identityHashCode from critical loops.

According to the profiler we were spending about 12% of our time in
System.identityHashCode.  Which is simply unacceptable within our
really tight search loop in WindowCache.

Since WindowProviders are few and far between (only 2 per pack file,
and not very many pack files per Repository) we can easily afford
the 4 bytes of memory required to compute the identityHashCode once
and keep it in a package access instance member.

This drops our running time from 2180 ms to 1960 ms, getting us very
close to C git.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
org.spearce.jgit/src/org/spearce/jgit/lib/WindowProvider.java