Rewrite WindowCache to use a hash table
commitd4353339d72a0f918ad2372b8f5af99b973f56cb
authorShawn O. Pearce <spearce@spearce.org>
Sat, 27 Dec 2008 17:32:51 +0000 (27 09:32 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 4 Jan 2009 00:05:33 +0000 (4 01:05 +0100)
treed38996ca098316668534693c6e3a00482d4708d5
parent20f2172d133658905d318c36562172901bdd7854
Rewrite WindowCache to use a hash table

This shaved 10s off my linux-2.6 "jgit rev-list --objects" test.
We're also getting slightly better cache hit ratios, approaching
95% during commit access and 80% during tree access on the same
repository.  Its a significant win.

The cache is also a bit better about memory usage.  We now make
sure the byte[] or ByteBuffer handle is cleared out of the soft
reference when we push the reference into the queue manually. A
small change, but it makes a marked difference with the overall
JVM memory usage.

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/lib/ByteWindow.java
org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
org.spearce.jgit/src/org/spearce/jgit/lib/WindowedFile.java