Spaces:
Configuration error
Configuration error
File size: 621 Bytes
5641073 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
const { hash: hashWasm } = require('./dist/node');
const { hash: hashNative } = require('./dist/node-native');
const { createHash } = require('crypto');
[
{ size: '64B', data: Buffer.alloc(64) },
{ size: '64KB', data: Buffer.alloc(1024 * 64) },
{ size: '6MB', data: Buffer.alloc(1024 * 1024 * 6) },
].forEach(({ size, data }) =>
suite(size, () => {
['md5', 'sha1', 'sha256'].forEach(alg =>
bench(alg, () =>
createHash(alg)
.update(data)
.digest(),
),
);
bench('blake3 wasm', () => hashWasm(data));
bench('blake3 native', () => hashNative(data));
}),
);
|