So I was looking for a faster way to calculate MD5 checksums and ran across the Fast MD5 library - but when I benchmark it with Java 7 on my machine it comes out slower than the Java version.
Either I am doing something stupid (very likely) or Java 7 has implemented a better algorithm (also likely). Here's my super simple "benchmark" - maybe I just didn't have enough coffee today...
    MD5 digest = new MD5();
    System.out.println(MD5.initNativeLibrary(true));
    byte[] buff = IOUtils.readFully(new FileInputStream(new File("blahblah.bin")), 64000000, true);
    ByteBuffer buffer = ByteBuffer.wrap(buff);
    for (int j = 0; j < 100; j++) {
        start = System.currentTimeMillis();
        String md5Base64 = Utilities.getDigestBase64(buffer);
        end = System.currentTimeMillis();
        total = total + (end-start);
    }
    System.out.println("Took " + ((total)/100.00) + " ms. for " + buff.length+" bytes");
    total = 0;
    for (int i = 0; i < 100; i++) {
        start = System.currentTimeMillis();
        digest.Init();
        digest.Update(buff);
        digest.Final();
        end = System.currentTimeMillis();
        total = total + (end-start);
    }
    System.out.println("Took " + ((total)/100.00) + " ms. for " + buff.length+" bytes");
And I get:
Took 247.99 ms. for 64000000 bytes
Took 295.16 ms. for 64000000 bytes
Per a comment I ran the benchamrk over and over and got the strangest results. The FastMD5 calculation stays the same, but the Java 7 version gets slower. ????
Took 246.54 ms. for 64000000 bytes
Took 294.69 ms. for 64000000 bytes
************************************
Took 540.55 ms. for 64000000 bytes
Took 292.69 ms. for 64000000 bytes
************************************
Took 537.07 ms. for 64000000 bytes
Took 292.12 ms. for 64000000 bytes
 
     
     
     
    