super-fast-md5 icon indicating copy to clipboard operation
super-fast-md5 copied to clipboard

Bench

Open DevXiaolan opened this issue 4 years ago β€’ 3 comments

Node version: v17.4.0
normail md5     355490 ops       🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 
super-fast-md5        725495 ops       🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 🐌 

Codes

const crypto = require('crypto');
const FastMd5 = require('super-fast-md5').md5;
const Bench = require('@mohism/bench').default;

const bench = new Bench();

const md5 = text => {
  return crypto
    .createHash('md5')
    .update(text)
    .digest('hex');
};

const fastMd5 = text => {
  return FastMd5(text);
}

bench.add('normail md5',()=>{
  md5('123456');
});

bench.add('super-fast-md5',()=>{
  fastMd5('123456');
});

bench.run();

DevXiaolan avatar Mar 10 '22 07:03 DevXiaolan

This is a wasm version of the implementation, not as fast as the native nodejs implementation, but much faster than the js implementation, the main use will be in the browser.

imtaotao avatar Mar 10 '22 07:03 imtaotao

This is a wasm version of the implementation, not as fast as the native nodejs implementation, but much faster than the js implementation, the main use will be in the browser.

Got it,

DevXiaolan avatar Mar 10 '22 07:03 DevXiaolan

ε°΄ε°¬οΌŒθΏ˜ζ˜―ζ‰“δΈ­ζ–‡ε₯½δΊ†

DevXiaolan avatar Mar 10 '22 07:03 DevXiaolan