question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prefer zlib over zopfli for gzip?

See original GitHub issue

There was some nice work done in #36 to make iltorb and node-zopfli-es optional.

But zopfli-compat.js is preferring zopfli over zlib, and printing a warning if node-zopfli-es is not installed. zopfli may create gzip assets 5% smaller than zlib, but it is much slower (~100x).

Since shrink-ray-current is for use at runtime, speed is very important and I would prefer to use zlib not zopfli. This would be consistent with brotli-compat.js which is preferring zlib over iltorb. Would you be open to this change, or alternatively silencing the warning Module "node-zopfli-es" was unavailable?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
keeganstreetcommented, Sep 23, 2019

Hi Alorel, that’s OK. If we add an option the change might look something like this:

  • Add a boolean option called useZopfliForGzip which defaults to true
  • In index.js, move const zopfli = zopfliCompat(); inside the compression function so we can pass opts.useZopfliForGzip to zopfliCompat.
  • In zopfli-comat.js, return require('zlib') if useZopfliForGzip is false.

Would you like a PR for this?

0reactions
Alorelcommented, Sep 28, 2019

Thanks for the contribution, published as 4.1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to implement zopfli for a better gzip compression?
You can use zopfli in advance, to pre-compress your assets before deploying them on the server. One way you can now do this...
Read more >
Improved Compression Ratios Using Zopfli - Dean Hume's Blog
Most modern browsers work effectively with compressed files and use lossless compression formats such as Gzip, Deflate or Zlib.
Read more >
Zopfli - Wikipedia
Zopfli is a data compression library that performs Deflate, gzip and zlib data encoding. It achieves higher compression ratios than mainstream Deflate and ......
Read more >
Comparison of Brotli, Deflate, Zopfli, LZMA, LZHAM and Bzip2 ...
We compared the performance of brotli by measuring the compression ratio and speed, as well as decompression speed on three different corpora: the...
Read more >
Compress data more densely with Zopfli - Hacker News
(Though as mentioned as a pro of zopfli, xz would lose on decompression ... a .gz file which is compatible with standard tools...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found