5 ms·
It's pretty light compression from what I can tell - basically just squashing down runs of nulls to a single count.
by makomk 8y ago
It's pretty light compression from what I can tell - basically just squashing down runs of nulls to a single count.
- wtmcc 8y agoThe compression is basic run-length encoding, leveraging the Perl repetition operator (x), and the property of the Perl print/say functions that they concat items passed in a list before writing to STDOUT. https://en.wikipedia.org/wiki/Run-length_encoding https://en.wikipedia.org/wiki/Run-length_encoding https://perldoc.perl.org/perlop.html#Multiplicative-Operators https://perldoc.perl.org/perlop.html#Multiplicative-Operator... https://perldoc.perl.org/functions/say.html https://perldoc.perl.org/functions/say.html https://perldoc.perl.org/functions/print.html https://perldoc.perl.org/functions/print.html
- lucb1e 8y agoI tried xz -9 on it and found, to my surprise, that it was actually longer than RLE! Then I tried gzip -9, because perhaps that has a smaller header? Yup, saved a few bytes, now it's about the same size. Finally, I remembered that bzip2 does a lot better on text than gzip, and who knows, it might also have a shorter header than xz. Again, a few more bytes saved! Down to 223, where the original is 249 bytes (including the 'say' part but excluding the unnecessary delimiting apostrophes or the rest of the command).
- mlindner 8y agoIt's not compressed. It's run length encoding which is an encoding, not compression.