I suppose zipping is no option?

So what's wrong with storing only the differences for a line?

Consecutive entries are normally less than 10 apart. You only need 4 bits for 0-15.

I'd probably use 0 as escape code to enter bigger differences a bit like utf 8 does its compression.

I had to download and run your code on my mobile, some sample output would have been nice.

Did it as a proof of concept to run Emacs and Perl inside termux there, which is uber mega cool!!! xD

Here my tweaked insights for others (I deleted the ord and the 33+ and added delimiters for each number and group.

2:5:8: 13:17: 22:25:27: 33:39: 45: 55:58: 67: 77: + 83:86: 2: 12:15:18: 25:29: 34:39: 44:48: 58: 62:66:68: 7 +2:75: 83:87: 3:6: 17: 26: 33:36: 45:47: 57: 65:69: 73:76:79: + 84:88: 8: 15: 23: 36: 43:49: 55: 75: 84:89:

Update
So any code d with 0<d<16 is a difference

0ab is the code for a difference with 0<0xab<256

You'll also need to denote the line's end.

Either by a counter at the beginning or with 000 or 0000 for newline.

Since this code works with 4 bit nibbles you'll get a binary format.

If you need an ASCII representation use base64 then.

If you need better compression look up Huffman coding on WP.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice


In reply to Re: Data compression by 50% + : is it possible? by LanX
in thread Data compression by 50% + : is it possible? by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.