
Pako does not contain some specific zlib functions: fill data to uncompress here try ) ) Notes deflate ( input ) // Inflate (simple wrapper can throw exception on broken stream) // const compressed = new Uint8Array ( ) //. fill input data here const output = pako. You can change deflate level to 0 in benchmark source, to investigate details.įor deflate level 6 results can be considered as correct.Ĭonst pako = require ( 'pako' ) // Deflate // const input = new Uint8Array ( ) //. Zlib's test is partially affected by marshalling (that make sense for inflate only). Ungzip-pako x 113 ops/sec ☐.62% (80 runs sampled) Inflate-zlib x 402 ops/sec ☐.74% (87 runs sampled) Inflate-pako x 134 ops/sec ☐.66% (83 runs sampled) Inflate-imaya x 110 ops/sec ☐.41% (77 runs sampled) Node v14.15.0 (google's zlib), 1mb output sample: deflate-imaya x 4.93 ops/sec ☓.09% (16 runs sampled)ĭeflate-pako x 10.22 ops/sec ☐.33% (29 runs sampled)ĭeflate-zlib x 18.48 ops/sec ☐.24% (48 runs sampled) Ungzip-pako x 115 ops/sec ☑.92% (80 runs sampled) Inflate-zlib x 258 ops/sec ☐.66% (88 runs sampled) Inflate-pako x 131 ops/sec ☑.74% (82 runs sampled) Inflate-imaya x 107 ops/sec ☐.69% (77 runs sampled) Gzip-pako x 8.86 ops/sec ☑.41% (29 runs sampled) This project was done to understand how fast JS can be and is it necessary toĭevelop native C modules for CPU-intensive tasks.

Almost as fast in modern JS engines as C implementation (see benchmarks).Results are binary equal to well known zlib (now contains ported zlib v1.2.8).
