Cache and reuse Inflater objects whenever possible.
commit6c127ab5290700af859fa1d6df204df96c281f80
authorShawn O. Pearce <spearce@spearce.org>
Thu, 30 Nov 2006 06:56:58 +0000 (30 01:56 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 30 Nov 2006 06:56:58 +0000 (30 01:56 -0500)
treeba92d779e9b6f740d2c469a3f72b887eb0b042bc
parent5f728b55c8ad28f3394fc4a93cc2465e27d7f585
Cache and reuse Inflater objects whenever possible.

It turns out that creating and destroying Inflater objects was costing
us a lot of time (about 14% according to the profiling).  So this adds
a cache of Inflaters to the WindowCache, thereby allowing all files
sharing the same cache of windows to also share the same set of Inflater
objects.

This change appears to make a huge difference in performance.  Before
this change the non-mmap 50,000 commit Mozilla walk case was averaging
4677 ms per 50,000 commit walk.  After this change the average has
dropped to a mere 2180 ms.  That's just over 2x faster, and puts jgit
at just over 300 ms slower than C git, assuming jgit was able to load
its windows into memory first.

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