Performance of CGI Reduced

Discussion in 'Perl Misc' started by Praki, Dec 14, 2007.

  1. Praki

    Praki Guest

    Hi All,

    when i use

    use CGI;
    use CGI::Session;
    use Net::LDAP;

    in my cgi file the performance is reduced. i mean it takes more time
    to get load every time and all the pages where ever i use this .
    why it is happening ? is there any other alternative for this...

    Thanks,
    Prakash
     
    Praki, Dec 14, 2007
    #1
    1. Advertising

  2. Praki

    Japhio Guest

    On Dec 14, 6:28 am, Praki <> wrote:

    > use CGI;
    > use CGI::Session;
    > use Net::LDAP;
    >
    > in my cgi file the performance is reduced. i mean it takes more time
    > to get load every time and all the pages where ever i use this .


    More time than what?
    Using those modules means slurping several thousand lines of code into
    your program, and yes, that takes some time.

    > why it is happening ? is there any other alternative for this...


    If you are using Apache, have a look at mod_perl http://perl.apache.org/,
    which embeds a Perl interpreter in your webserver and caches the
    compiled Perl code.
     
    Japhio, Dec 14, 2007
    #2
    1. Advertising

  3. Praki

    Guest

    Praki <> wrote:
    > Hi All,
    >
    > when i use
    >
    > use CGI;
    > use CGI::Session;
    > use Net::LDAP;
    >
    > in my cgi file the performance is reduced.


    As compared to what? Using none of the above? Using one of the above?
    Using two of the above?

    > i mean it takes more time
    > to get load every time and all the pages where ever i use this .
    > why it is happening ? is there any other alternative for this...


    mod_perl, for example. See the FAQ "How can I make my CGI script more
    efficient?"

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
     
    , Dec 14, 2007
    #3
  4. Petr Vileta wrote:
    > Praki wrote:
    >> when i use
    >>
    >> use CGI;
    >> use CGI::Session;
    >> use Net::LDAP;
    >>
    >> in my cgi file the performance is reduced. i mean it takes more time
    >> to get load every time and all the pages where ever i use this .
    >> why it is happening ? is there any other alternative for this...

    >
    > You can use part only
    >
    > use CGI qw:)cgi);
    > or
    > use CGI qw:)standard);
    > or other part you need.


    That would import a bunch of symbols, and I don't understand how it
    would improve performance.

    To the OP: As others have mentioned, you may want to run the program
    under mod_perl. Otherwise, as long as you run it as a plain CGI script,
    and if speed is an issue, avoid using CGI.pm.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Dec 14, 2007
    #4
  5. Gunnar Hjalmarsson <> wrote in news:5sg65eF192aisU1
    @mid.individual.net:

    > Petr Vileta wrote:
    >> Praki wrote:
    >>> when i use
    >>>
    >>> use CGI;
    >>> use CGI::Session;
    >>> use Net::LDAP;
    >>>
    >>> in my cgi file the performance is reduced. i mean it takes more time


    ....

    >> You can use part only
    >>
    >> use CGI qw:)cgi);
    >> or
    >> use CGI qw:)standard);
    >> or other part you need.

    >
    > That would import a bunch of symbols, and I don't understand how it
    > would improve performance.


    Given that most of the penalty for using CGI.pm comes from having to
    load, parse and compile that behemoth, changing the set of imported
    routines would, as you point out, not increase performance.

    >
    > To the OP: As others have mentioned, you may want to run the program
    > under mod_perl. Otherwise, as long as you run it as a plain CGI
    > script, and if speed is an issue, avoid using CGI.pm.


    And one very good way to avoid CGI.pm (so long as one does not need the
    HTML generation methods) is to use CGI::Minimal:

    http://search.cpan.org/~snowhare/CGI-Minimal-1.29/lib/CGI/Minimal.pod

    I would still prefer to go with a CPAN module than home-brew solutions.

    Sinan

    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)
    clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>
     
    A. Sinan Unur, Dec 15, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff S
    Replies:
    1
    Views:
    361
    Scott Allen
    Jan 20, 2004
  2. Leon
    Replies:
    2
    Views:
    3,027
  3. VisionSet

    reduced scope imports

    VisionSet, Dec 16, 2005, in forum: Java
    Replies:
    2
    Views:
    363
    VisionSet
    Dec 17, 2005
  4. Richard Rundle

    Spans overlap when viewport is reduced

    Richard Rundle, Mar 7, 2006, in forum: HTML
    Replies:
    4
    Views:
    461
    Richard Rundle
    Mar 8, 2006
  5. Philipp

    Reduced bit number in short

    Philipp, Apr 28, 2004, in forum: C++
    Replies:
    7
    Views:
    387
    Jacek Dziedzic
    Apr 29, 2004
Loading...

Share This Page