in reply to is precompiling possible / effective?

The reason that perl doesn't store compiled bytecode on disk is that reading that bytecode is usually slower than re-compiling an application. So that's not an option here.

What you can do is use a system like FastCGI or mod_perl where each request is a function call into a persistent process rather than an entirely new process.

If you're lucky you don't always have to generate the file, but you can cache it.

  • Comment on Re: is precompiling possible / effective?

Replies are listed 'Best First'.
Re^2: is precompiling possible / effective?
by MashMashy (Sexton) on Feb 12, 2009 at 23:43 UTC
    Is there a way to determine how effective that will be / if it is worth doing?
      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!)