xxhash-wasm-vn
v1.2.3
Published
XXHASH for WebAssembly
Maintainers
Readme
xxhash-wasm-vn
Node.js
const { xh32, xxh64, xxh3_64, xxh3_128 } = require('xxhash-wasm-vn/nodejs');
Browser
import init, { xxh32, xxh64, xxh3_64, xxh3_128 } from 'xxhash-wasm-vn/web';
await init();
// Classic XXHash
const data = new TextEncoder().encode("hello world");
console.log("xxh32: ", xxh32(data, undefined));
console.log("xxh64: ", xxh64(data, undefined));
console.log("xxh3 (64): ", xxh3_64(data, undefined));
console.log("xxh3 (128): ", xxh3_128(data, undefined));Benchmark
| (index) | Task name | Latency avg (ns)| Latency med (ns)| Throughput avg (ops/s) | Throughput med (ops/s)| Samples | | --------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | | 0 | 'xxh32' | '1050.0 ± 4.36%' | '0.00 ± 0.00' | '942455 ± 0.05%' | '952350 ± 0' | 190470 | | 1 | 'xxh64' | '690.73 ± 4.37%' | '0.00 ± 0.00' | '1437814 ± 0.03%' | '1447740 ± 0' | 289548 | | 2 | 'xxh3 (64)' | '548.75 ± 4.37%' | '0.00 ± 0.00' | '1812379 ± 0.02%' | '1822324 ± 0' | 364647 | | 3 | 'xxh3 (128)' | '723.54 ± 4.38%' | '0.00 ± 0.00' | '1372186 ± 0.03%' | '1382094 ± 0' | 276557 |
