summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2013-04-15 09:38:56 (EDT)
committerPascal Rapicault2013-04-16 12:10:07 (EDT)
commitd330aa59060a33bd44ac2fa5a2148c7300fcd0ca (patch)
treeb7a22062dc127c2b2b11cddf6c7e575c6e659dbd
parentb488ec8cf71d0821de5a0e7b065ccadb18e569a3 (diff)
downloadrt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.zip
rt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.tar.gz
rt.equinox.p2-d330aa59060a33bd44ac2fa5a2148c7300fcd0ca.tar.bz2
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.java6
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 67abd74..c7da228 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();