On Sat, 18 Sep 2004, Gunnar Hjalmarsson wrote:

> Chris Devers wrote:
> > if you need a speed boost then the best strategies are to [a] use a
> > smaller subset of CGI.pm,
> 
> Does that really make a lot of difference?

That was my understanding, but I admit I haven't benchmarked it. 

If only importing part of CGI.pm offers no performance advantage, what's 
the point in doing it? Just avoiding polluting your namespace?

> If you use mod_perl, you don't need to compile CGI.pm (or anything 
> else) everytime a script is invoked, so in that respect I can 
> understand what you mean. But would mod_perl have a significant impact 
> on speed in any other respect? Isn't it still a set of code that shall 
> be executed?

Yes, you still end up running a lot of code with each page request, but 
loading everything just when Apache starts can make a big difference.

You can do better by doing mod_perl and not using CGI.pm, but that gets 
into more advanced techniques and a better understanding of how Apache 
works. It can be worth it in the long run, but there's a lot to learn.

The switch from CGI.pm/cgi to CGI.pm/mod_perl doesn't have as steep of a 
learning curve, but the benefits can still be very significant. My hunch 
is that it's the sweet spot for new programmers that want scripts to run 
reasonably quickly but don't want to plunge in to a huge topic.

YMMV, of course :-)


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to