mscdex / node-xxhash

An xxhash binding for node.js
Other
193 stars 28 forks source link

Fast API #40

Open ronag opened 1 month ago

ronag commented 1 month ago

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.

asilvas commented 1 month ago

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

mscdex commented 1 month ago

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.