Octavian Rasnita wrote:
I have made a program and I have made some benchmarks in order to
see how much time consumes each part of it, and I was pretty
surprised when I've seen that the CGI module takes very much
comparing with the other parts of the program.

CGI.pm is a huge module, and if you are only using it for doing simple things, it slows down your script considerably. This is a benchmark I did: http://groups.google.se/groups?selm=bp9hb9%241kv1vv%241%40ID-184292.news.uni-berlin.de

Usually I still use it, because it's convenient to do so. After all
(and unfortunately) it's the only module for CGI stuff that is
included in the standard Perl distribution. The questions I ask myself
are:

1. Will the users of the CGI application notice a difference?

2. Will the script become so heavily used so that the additional CPU
caused by CGI.pm might cause overloading of the server?

Typically the answer to both those questions is "no".

For one redirect application, where the answer to question 2. above
might be "yes", I'm using my own code. Unlike the impression that some
gurus like to give, I didn't find it particularly difficult to do so.
Of course, copying and using others' code out of context, without
enough understanding of what you are doing, is not advisable. OTOH,
you shouldn't deal with CGI without knowing what you are doing anyway. ;-)

Using an alternative CGI library is another option. Chris mentioned a
couple, and I'd like to add CGI::Minimal to the list.

Can you recommend me some tricks to make it work a little faster?

No.

If I want to use the OOP style, is it possible to load only some
methods and not all?

Sure, that's what you normally do, isn't it? However, whether you import a few function names or not has probably very little impact on speed.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
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