public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 
var crypto = require('crypto');
var crc32 = require('crc').crc32;
 
var x = 1;
while(1){
 
var string = '';
for (var j=0; j<x; j++) {
string += String(Math.random());
}
 
var iter = 1000000/Math.sqrt(x);
 
var start = Date.now();
for (var i=0; i<iter; i++) {
crypto.createHash('md5').update(string).digest('hex');
}
var fin1 = Date.now();
 
for (var i=0; i<iter; i++) {
crc32(string);
}
 
console.log(string.length, (fin1-start)/iter*1000000, (Date.now()-fin1)/iter*1000000);
 
x*=1.5;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.