2005-07-05

* Use a buffered PRNG, pulling the PRNG data off a larger precalculated
      buffer, rather than the underlying PRNG's (likely small) one, which in
      turn reduces the frequency of recalcing.
    * More tuning to reduce temporary allocation churn
This commit is contained in:
jrandom
2005-07-05 22:08:56 +00:00
committed by zzz
parent 18d3f5d25d
commit f688b9112d
22 changed files with 709 additions and 65 deletions

View File

@ -37,10 +37,11 @@ import java.util.Properties;
public class HMACSHA256Bench {
public static void main(String args[]) {
runTest(new I2PAppContext());
System.out.println("Running as MD5");
Properties props = new Properties();
props.setProperty("i2p.fakeHMAC", "true");
//props.setProperty("i2p.fakeHMAC", "true");
props.setProperty("i2p.HMACMD5", "true");
runTest(new I2PAppContext(props));
}
private static void runTest(I2PAppContext ctx) {
SessionKey key = ctx.keyGenerator().generateSessionKey();
@ -109,7 +110,7 @@ public class HMACSHA256Bench {
private static void display(int times, long before, long after, int len, String name) {
double rate = ((double)times)/(((double)after-(double)before)/1000.0d);
double kbps = ((double)len/1024.0d)*((double)times)/(((double)after-(double)before)/1000.0d);
System.out.println(name + " HMAC-SHA256 pulled " + kbps + "KBps or " + rate + " calcs per second");
System.out.println(name + " HMAC pulled " + kbps + "KBps or " + rate + " calcs per second");
}
}