Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Can Perl remain persistent for scripts just like mod_perl does for apache?

by tye (Sage)
on Dec 30, 2000 at 09:05 UTC ( [id://48974]=note: print w/replies, xml ) Need Help??


in reply to Can Perl remain persistent for scripts just like mod_perl does for apache?

I can certainly understand the desire for this. The start-up time for Perl scripts can be a bit of a problem (otherwise there would be no need for mod_perl -- though it is usually more of a problem when serving web pages than most other situations).

Each time you run a script, the perl executable must start up, initialize a new interpreter, then compile the script and any modules or other stuff that the script requires. This can add up -- though, I think this is less often noticed as a problem on modern machines that have to be faster to deal with the growing software bloat.

If perl is being run often, then most operating systems will keep the perl executable cached in memory (if not short on RAM). But the operating system can't cache the compiled Perl script no matter how often you run it.

A lot of work has been put into a pre-compiler for Perl that takes a Perl script and compiles it to some other format that is much faster for Perl to load. Initially the load time for the pre-compiled scripts was actually longer than the original compile time because of the amount of data that had to be read in.

I hear much improvement has been made in this area so you should check out the B (for Backend) modules and tools that come standard with modern versions of Perl.

I've often wanted a good Perl shell that would let me do simple things like "rm file" without loading any external executables and would let me do more complex things by loading a module so that each time I want to do that again, it is already loaded for me. But that will only help start-up of some interactive commands.

If you have just a few particular scripts that are being run over and over, then there are things you can do to speed those up, making all or much of the script into a demon that is always running, for example.

tye (Nothing is obvious unless you are overlooking something)
  • Comment on Re: Can Perl remain persistent for scripts just like mod_perl does for apache?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://48974]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found