Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^5: Perl script compressor

by afoken (Canon)
on Dec 09, 2019 at 22:05 UTC ( #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 (Friar) 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
Node Status?
node history
Node Type: note [id://11109888]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-06-01 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (11 votes). Check out past polls.

    Notices?