ipfs-inactive / js-ipfs-unixfs-importer

[ARCHIVED] JavaScript implementation of the UnixFs importer used by IPFS
MIT License
5 stars 4 forks source link

feat: use a rabin chunker in wasm #31

Closed hugomrdias closed 5 years ago

hugomrdias commented 5 years ago

This PR adds a WASM rabin chunker that works in node and js. If merged this will be the first wasm module in js-ipfs code base Yay 🚀

some benchmarks on a 100Mb random stream

native rabin x 0.51 ops/sec ±2.56% (7 runs sampled) wasm rabin x 0.23 ops/sec ±2.72% (6 runs sampled) js rabin x 0.05 ops/sec ±3.78% (5 runs sampled) Fastest is native rabin

This makes the wasm version consistently 50% slower (it will only get faster) than native but works in the browser, node 10 and 12 and has no native dependencies.

Regarding size Package size: 4.66 KB with all dependencies, minified and gzipped

/cc @ipfs/wg-js-core