Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Perl script compressor

by afoken (Chancellor)
on Dec 09, 2019 at 22:05 UTC ( [id://11109888]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl script compressor
in thread Perl script compressor

And it is reducing perl code from 13,997 bytes to 4,750 bytes! That's less than half of the original. And we're not even using gzip here.

Even better, only 85% of the crippled code, 29% of the original code, and still lossless and maintainable:

/tmp>gzip -9 < 11109869.pl > 11109869.pl.gz /tmp>lzma -9 < 11109869.pl > 11109869.pl.lzma /tmp>bzip2 -9 < 11109869.pl > 11109869.pl.bz2 /tmp>dir 11109869.pl* -rw-r--r-- 1 alex users 13999 Dec 9 23:01 11109869.pl -rw-r--r-- 1 alex users 4110 Dec 9 23:02 11109869.pl.bz2 -rw-r--r-- 1 alex users 4296 Dec 9 23:02 11109869.pl.gz -rw-r--r-- 1 alex users 4099 Dec 9 23:02 11109869.pl.lzma /tmp>

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^6: Perl script compressor
by harangzsolt33 (Chaplain) on Dec 10, 2019 at 03:22 UTC
    Okay, but if a perl script has to be unzipped before it can run, then this takes time. My compact perl code doesn’t modify the code’s structure or anything. It just removes spaces and renames variables. The perl script can run the same way, and no decompression is necessary.

      Your assessment is correct, but your bigger picture analysis is fundamentally flawed. You have already spent many orders of magnitude more of your time on this project than the total processor time likely to be saved over the lifetime of the code to be compressed. As davido has demonstrated the per-load time savings is completely inconsequential.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

      "My compact perl code doesn’t modify the code’s structure or anything. It just removes spaces and renames variables."

      It also doesn't address any of the problems you've decided exist, even though it's been it's been explained to you that your understanding of the process is wrong. But it's not the first time we've been in this situation.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-16 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found