]> source.dussan.org Git - jgit.git/commit
Remember loose objects and fast-track their lookup 55/1555/3
authorShawn O. Pearce <spearce@spearce.org>
Wed, 8 Sep 2010 02:16:39 +0000 (19:16 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 8 Sep 2010 05:28:06 +0000 (22:28 -0700)
commit3f66e65e710adf3649b10385f899f3df6d680922
treefb6927becaaefc7cfcf4f7b5e3df596c86140150
parenteb64ccad6d0ec1c8dbe4419c6e4ff564d1fac167
Remember loose objects and fast-track their lookup

Recently created objects are usually what branches point to, and
are usually written out as loose objects.  But due to the high cost
of asking the operating system if a file exists, these are the last
thing that ObjectDirectory examines when looking for an object by
its ObjectId.

Caching recently seen loose objects permits the opening code to
jump directly to the loose object, accelerating lookup for branch
heads that are accessed often.

To avoid exploding the cache its limited to approximately 2048
entries.  When more ids are added, the table is simply cleared
and reset in size.

Change-Id: I18f483217412b102f754ffd496c87061d592e535
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObjectCache.java [new file with mode: 0644]