diff options
author | Jan Sievers | 2013-04-15 13:38:56 +0000 |
---|---|---|
committer | Pascal Rapicault | 2013-04-16 16:10:07 +0000 |
commit | d330aa59060a33bd44ac2fa5a2148c7300fcd0ca (patch) | |
tree | b7a22062dc127c2b2b11cddf6c7e575c6e659dbd | |
parent | b488ec8cf71d0821de5a0e7b065ccadb18e569a3 (diff) | |
download | rt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.tar.gz rt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.tar.xz rt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.zip |
Bug 405716: use 4k buffer to update MD5 digest
... instead of byte-by-bye update.
Typical performance gain for a 300k jar file
is factor 5 faster MD5 calculation.
Bug: 405716
-rw-r--r-- | bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java index 67abd747f..c7da22884 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java @@ -129,8 +129,10 @@ public class PublisherHelper { try { fis = new BufferedInputStream(new FileInputStream(file)); int read = -1; - while ((read = fis.read()) != -1) { - md5Checker.update((byte) read); + final int bufferSize = 4 * 1024; + byte[] buffer = new byte[bufferSize]; + while ((read = fis.read(buffer, 0, bufferSize)) != -1) { + md5Checker.update(buffer, 0, read); } byte[] digest = md5Checker.digest(); StringBuffer buf = new StringBuffer(); |