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

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

Replies are listed 'Best First'.
Re^4: is precompiling possible / effective?
by MashMashy (Sexton) on Feb 12, 2009 at 23:50 UTC
    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).
        It does miss the time it takes to load perl itself, though. That could be addressed by adding the time taken by perl -e1 to your results.
        oho, thank you so much!