Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce2010-09-06 16:59:35 +0000
committerShawn O. Pearce2010-09-06 17:09:12 +0000
commit693f454e71df226fd72e996bb28fca6640ed5dc5 (patch)
tree805154c0ec79f25118d7f3952565c77ba7ab7dc2
parent88adf21c475bd6124dfd8c3a5416a325738b193d (diff)
downloadjgit-693f454e71df226fd72e996bb28fca6640ed5dc5.tar.gz
jgit-693f454e71df226fd72e996bb28fca6640ed5dc5.tar.xz
jgit-693f454e71df226fd72e996bb28fca6640ed5dc5.zip
Use 8192 as default buffer size in ObjectLoader copyTo
As ObjectStreams are supposed to be buffered, most implementors will be wrapping their underlying stream inside of a BufferedInputStream in order to satisfy this requirement. Because developers are by nature lazy, they will use the default buffer size rather than specify their own. The OpenJDk JRE implementations use 8192 as the default buffer size, and when the higher level reader uses the same buffer size the buffers "stack" nicely by avoiding a copy to the internal buffer array. As OpenJDK is a popular virtual machine, we should try to benefit from this nice stacking property during copyTo(). Change-Id: I69d53f273b870b841ced2be2e9debdfd987d98f4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
index 0fc3bce65b..fe4a7fdc0d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
@@ -256,7 +256,7 @@ public abstract class ObjectLoader {
ObjectStream in = openStream();
try {
final long sz = in.getSize();
- byte[] tmp = new byte[1024];
+ byte[] tmp = new byte[8192];
long copied = 0;
while (copied < sz) {
int n = in.read(tmp);

Back to the top