node-xxhash icon indicating copy to clipboard operation
node-xxhash copied to clipboard

Fast API

Open ronag opened this issue 1 year ago • 2 comments

This repo is currently pretty much 1:1 in terms of performance relative to xxhash-wasm. What could make this faster would be to be implemented with V8 fast api (though it would probably only work with Node then).

benchmark        time (avg)             (min … max)       p75       p99      p999
--------------------------------------------------- -----------------------------
xxhash-wasm   54.96 ns/iter   (50.09 ns … 1'243 ns)  54.38 ns  94.16 ns    433 ns
hash-rs         263 ns/iter     (237 ns … 2'276 ns)    261 ns    381 ns  2'254 ns
xxhash        60.22 ns/iter   (52.92 ns … 4'086 ns)  58.06 ns  68.42 ns  1'145 ns

Otherwise, I don't really see any reason to use this over xxhash-wasm. Other than if you want to the result into a Buffer rather than a BigInt.

ronag avatar Sep 14 '24 20:09 ronag

If you're willing to switch runtimes, Bun has hashing built in and is much faster. Pretty much drop in replacement for Node.

asilvas avatar Sep 14 '24 20:09 asilvas

Otherwise, I don't really see any reason to use this over xxhash-wasm.

You're right. I should probably delete the repository and destroy any evidence that this project ever existed.

mscdex avatar Sep 14 '24 22:09 mscdex