Improve hit performance on the UnpackedObjectCache
commitedbd75dd18b6fe184277795331450ed1ea09ad8c
authorShawn O. Pearce <spearce@spearce.org>
Thu, 25 Dec 2008 02:10:57 +0000 (24 18:10 -0800)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 4 Jan 2009 00:01:52 +0000 (4 01:01 +0100)
treed28787e0ce665d6de2ab28197c6e26a9a2a51a9b
parenta4548aedff912c48ff3008238024e012f2c3d2be
Improve hit performance on the UnpackedObjectCache

If the JVM cleared one of our SoftReferences we "leaked" the space in
the cache that the entry occupied.  Over time this meant we lost room
in the cache and didn't have a way to recover that when we replaced
the evicted entry.

The hash function was also too complex for the hit ratio we were
getting.  The old function on one of my linux-2.6 clones was giving
us <7% hit ratio; this new function is a little simpler to compute
and is getting ~11%.  Increasing the size of the hash table helps
matters considerably.

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/UnpackedObjectCache.java