Live data from Hacker News

Zlib visualizer

lynn.github.io

31–33 of 33 posts

Re: Zlib visualizer

#31

The byte counter seems broken somehow. "Compressing" a single character with a compression level of 0 says "12 bytes", yet in the visualization there's less than 8 bytes (~7.5). When compressing with a level higher than 0, the bits also don't appear to add up to a natural number of bytes, so I'm thinking the visualization is missing some padding?

At least for me, compressing a single "a" at compression level 0 gives me an output of 91 bits, which rounds up to 12 bytes.

I fixed the bug after reading the comment you replied to :) (I'm @lynn)

The LEN and NLEN items were not getting visualized.

Re: Zlib visualizer

#32
post #22
post #11

As someone who's never really read that much on compression stuff, I have absolutely zero clue what this visualisation is actually showing me. That's compounded by the lack of legend. What do the different shades of blue and purple tell me? What is Orange? e.g. on a given text in an orange block it puts e.g. x4 seems to indicate that the first 4 binary values for the block are important, but I can't figure out what t…

Using this example paragraph, at compression level 1 or higher (copy with the quotation symbols): “It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair.” The red bit at the beginning is Z…

Thank you! I appreciate the explanation

Re: Zlib visualizer

#33
post #32
post #22

Earlier quoted context omitted.

Using this example paragraph, at compression level 1 or higher (copy with the quotation symbols): “It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair.” The red bit at the beginning is Z…

Thank you! I appreciate the explanation

Happy to help :) I think compression algorithms are super cool, and zlib is a nice example of how just two simple techniques (Huffman coding and dictionary compression) can combine to usefully compress nearly any real-world data.

Newer compression algorithms like zstd, brotli and lz4 basically just use these same methods in different ways. (There's also slightly newer alternatives to Huffman coding, like Asymmetric Numeral Systems and Arithmetic Coding, but fundamentally they're the same concept).

Post reply on HN