Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Data compression by 50% + : is it possible?

by bliako (Priest)
on May 11, 2019 at 23:53 UTC ( #1233621=note: print w/replies, xml ) Need Help??

in reply to Data compression by 50% + : is it possible?

It's too late for me and I may be wrong, but storing the first character and then the deltas (e.g. consecutive character differences) (got the idea from LanX's Re: Data compression by 50% + : is it possible?) achieved ~50% compression using gzip:

# use strict; #never warnings; my @inp = (); #daraset for (1..100){ my @ani = (); for (my $x=0; $x<90; $x+=10){ my @c; push(@c, int (rand(10)+$x)); push(@c, int (rand(10)+$x)); push(@c, int (rand(10)+$x)); push(@c, int (rand(10)+$x)); @c = sort{$a<=>$b}@c; for (my $i = 1; $i < @c; $i++){ push(@ani, chr(33+$c[$i])) if $c[$i] != $c[$i- +1] && $c[$i] != $c[$i-1]+1 ; } } push @inp, \@ani; } foreach my $abc (@inp){ print $abc->[0]; for(my $x=1;$x<@$abc;$x++){ print ord($abc->[$x])-ord($abc->[$x-1]); } print "\n"; }
perl > xyz ls -al xyz gzip xyz ls -al xyz.gz

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1233621]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2019-06-19 00:41 GMT
Find Nodes?
    Voting Booth?
    Is there a future for codeless software?

    Results (83 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!