in reply to Re: is precompiling possible / effective?
in thread is precompiling possible / effective?

Is there a way to determine how effective that will be / if it is worth doing?
  • Comment on Re^2: is precompiling possible / effective?

Replies are listed 'Best First'.
Re^3: is precompiling possible / effective?
by moritz (Cardinal) on Feb 12, 2009 at 23:48 UTC
    Sure. Try it out, and measure the difference.

    You can also try to measure the startup and initialization phase, and see if it's large enough to warrant the effort.

    #!/usr/bin/perl use Time::HiRes qw(time); my $start; BEGIN { $start = time() }; # rest of module loading here # then initialization (open database connections etc.) warn "Startup time: ", time() - $start; # rest of script goes here
      wouldn't that first $start be called AFTER the compilation, though? (thank you, by the way, for your help!)
        No, that's why I put the initialization in a BEGIN block - that means it's run immediately after that block is parsed. (Sure, it misses a small part of the compilation phase, but if you load many modules that part is really small compared to the rest).