Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: One Big Script v. Several Small Scripts

by Bilbo (Pilgrim)
on Jan 29, 2003 at 10:07 UTC ( [id://230900]=note: print w/replies, xml ) Need Help??


in reply to One Big Script v. Several Small Scripts

I have been wondering about this recently. People in this thread have suggested that having several small scripts saves on compile time because you don't compile the whole script every time. Does anyone know if this is really significant? If you are using the CGI module I would guess that this is significantly larger than your program (it's certainly bigger than mine) so wouldn't this dominate the compilation time, or have I missed something?

  • Comment on Re: One Big Script v. Several Small Scripts

Replies are listed 'Best First'.
Re: One Big Script v. Several Small Scripts
by skx (Parson) on Jan 29, 2003 at 10:27 UTC

     I think you're right to wonder about the benefits of this, especially if CGI.pm is involved.

     If the server is using a traditional approach to CGI's and having to do a fork() for each request the time taken for this may exclipse the perl compilation time.

     Mostly the CGI scripts I write are IO/network bound anyway - so little optimization is really possible.

    Steve
    ---
    steve.org.uk
Re: Re: One Big Script v. Several Small Scripts
by relax99 (Monk) on Jan 29, 2003 at 13:57 UTC
    I really don't think having perl to compile, say, 32K file versus 8K file adds a significant overhead. Besides, as some people rightly noticed, if you use CGI one of the major overheads is having to load perl compiler on each call. So you might want to extract some common functionality of your program in a module to provide for convenience and code reuse, but you don't need to split your main script into smaller pieces. Anyone who thinks otherwise can try benchmarking different approaches.

Log In?
Username:
Password:

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

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

    No recent polls found