imtaotao / super-fast-md5

md5
MIT License
21 stars 0 forks source link

Bench #1

Open DevXiaolan opened 2 years ago

DevXiaolan commented 2 years ago
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();
imtaotao commented 2 years ago

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.

DevXiaolan commented 2 years ago

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 commented 2 years ago

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