aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs/src
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-10-24 13:26:58 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2016-10-26 22:54:48 +0200
commit6dea5ec823c861de0a1490b2c6f9573e329e7e44 (patch)
treeeb484e2e67aac5190a1534cc42b7e3695ad298d6 /org.eclipse.jgit.lfs/src
parentd1bc809ccec210b82b0795fa9a7a0f988e330d81 (diff)
downloadjgit-6dea5ec823c861de0a1490b2c6f9573e329e7e44.tar.gz
jgit-6dea5ec823c861de0a1490b2c6f9573e329e7e44.zip
Speedup CleanFilter by transferring data in chunks of 8k
Transferring data byte per byte is slow, running add with CleanFilter on a 2.9MB file takes 20 seconds. Using a buffer of 8k shrinks this time to 70ms. Change-Id: I3bc2d8c11fe6cfaffcc99dc2a00643e01ac4e9cc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.lfs/src')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
index f7b55e579b..f7ad689744 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
@@ -141,11 +141,12 @@ public class CleanFilter extends FilterCommand {
public int run() throws IOException {
try {
- int b = in.read();
- if (b != -1) {
- dOut.write(b);
- size++;
- return 1;
+ byte[] buf = new byte[8192];
+ int length = in.read(buf);
+ if (length != -1) {
+ dOut.write(buf, 0, length);
+ size += length;
+ return length;
} else {
dOut.close();
tmpOut.close();