]> source.dussan.org Git - jgit.git/commit
Support large loose objects as streams 32/1032/1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 2 Jul 2010 01:26:17 +0000 (18:26 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 2 Jul 2010 01:26:17 +0000 (18:26 -0700)
commitfa23482ca71314ef412ca7b2a4a5ae6886507dcf
tree1bf0d64ed48d7a1a9441cfc4d99384cad87ccb0a
parent2489088235543732ee0874a090a98b344255a9a7
Support large loose objects as streams

Big loose objects can now be streamed if they are over the large
object size threshold.  This prevents the JVM heap from exploding
with a very large byte array to hold the slurped file, and then
again with its uncompressed copy.

We may have slightly slowed down the simple case for small
loose objects, as the loader no longer slurps the entire thing
and decompresses in memory.  To try and keep good performance
for the very common small objects that are below 8 KiB in size,
buffers are set to 8 KiB, causing the reader to slurp most of the
file anyway.  However the data has to be copied at least once,
from the BufferedInputStream into the InflaterInputStream.

New unit tests are supplied to get nearly 100% code coverage on the
unpacked code paths, for both standard and pack style loose objects.
We tested a fair chunk of the code elsewhere, but these new tests
are better isolated to the specific branches in the code path.

Change-Id: I87b764ab1b84225e9b5619a2a55fd8eaa640e1fe
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectStream.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObjectLoader.java [deleted file]
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java