Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: How to efficently pack a string of 63 characters

by LanX (Saint)
on Sep 10, 2021 at 07:45 UTC ( [id://11136629]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to efficently pack a string of 63 characters
in thread How to efficently pack a string of 63 characters

Yes I misread the glob like producing 9 runlength chunks 'AAAAA','AA','A',... and coding each as a byte.

I agree that this 5 to 1 is almost optimal, if the alphabet is really random, i.e without redundancy.

3**5=243 that means you are using 7.92 bits of the byte. Plus some more for smaller trailing chunks.

That's very efficient. The theoretical optimum is at 37.5 bytes and you only need 39.

But I think zip should do considerably better than 40% if this particular raw input was longer. (update: like proven here)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found