Skip to content

PrivateBin/zlib-wasm-without-emscripten-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zlib-wasm-without-emscripten-sample

A zlib WebAssembly binary build sample with dcodeIO/webassembly.

Initialize and Build code

$ git clone https://github.com/ukyo/zlib-wasm-without-emscripten-sample.git
$ cd zlib-wasm-without-emsripten-sample
$ npm install
$ npm run build

Example

const myZlib = await require("./src/index").initialize();
const deflated = myZlib.deflate(buffer);
console.log(myZlib.inflate(deflated).equals(buffer));

Benchmark

  • NodeJS: v8.9.1
  • OS: MacBook Pro
  • CPU: Intel Core i5 2.4GHz
  • Memory: 16GB
$ npm run bench

## lorem_1mb.txt size: 1000205
wasm x 9.61 ops/sec ±4.48% (27 runs sampled)
pako x 8.70 ops/sec ±2.26% (25 runs sampled)
native x 15.21 ops/sec ±3.15% (41 runs sampled)
Deflate: Fastest is native
## deflated lorem_1mb.txt size: 257012
wasm x 120 ops/sec ±10.26% (60 runs sampled)
pako x 106 ops/sec ±8.56% (67 runs sampled)
native x 211 ops/sec ±2.68% (74 runs sampled)
Inflate: Fastest is native

About

A zlib WebAssembly binary build sample.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 65.9%
  • Assembly 8.3%
  • Ada 5.2%
  • Pascal 4.4%
  • C++ 3.9%
  • C# 3.3%
  • Other 9.0%