Achilles_Sea has asked for the wisdom of the Perl Monks concerning the following question:

Hi everybody

I've compiled a exe file by par-packer, to deliver my perl program to one who has no perl environment on their machines. however, the first-time run of the exe in a new machine is always slow, then a second run becomes normal. in fact, my original perl program runs very fast. It seems the exe is loading something in its first running before it runs to the actual perl code. I wonder is there any reason, or it's just I missed something in my compilation.

I used the simplest command: pp -o autodsr.exe autodsr.pl

Replies are listed 'Best First'.
Re: why the exe runs so slow compiled by pp in the first time
by moritz (Cardinal) on Aug 23, 2011 at 14:18 UTC
    Well, the executable needs to unpack perl and all the of the modules, and that takes time. I guess that these files are stored somewhere, so that subsequent runs can reuse them, which speeds up the second run.
      I guess that these files are stored somewhere
      Yes, the unpacked files are stored in your temporary directory (and therefore likely to be reaped upon closing/restarting your computer).

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      the executable will unpack to perl?

      it's disappointing, I thought pp has turn it into a totally binary code which is no different to a common C program

        no, pp just 'packs perl' into a self extracting executable. definitely has it's uses, but it does not turn your code into binary.

        run procmon or something similar to find the path that your script.exe is running from and you can see all of your code and any included modules

        it's disappointing
        Why is that disappointing? It is still Perl.

        And as you remarked, its main use is to deploy applications on machines that do not have Perl installed.

        The docs of pp clearly state "Source files are compressed verbatim without compilation".

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James