Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RE: big performance gain

by arturo (Vicar)
on Sep 08, 2000 at 20:02 UTC ( [id://31609]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: Training wheels again
in thread Training wheels again

What makes me curious is the difference you see when you stop using CGI.pm. I realize this won't translate to the full-blown handler version of the script, but did you try loading CGI.pm via default in mod_perl, or did you have

use CGI;
in your script?

"He's got about as much personality as a loaf of bread" -- Wally Pleasant, She's in love with a Geek

Replies are listed 'Best First'.
RE: RE: big performance gain
by KM (Priest) on Sep 08, 2000 at 20:11 UTC
    Yeah, I would be interested in this too. Is CGI.pm being used from within a test script, or from startup.pl/httpd.conf? You could also try only importing things like use CGI qw/:standard/. I believe CGI.pm has some magic code inside to help with memory when you do so, although I haven't perused the source in quite some time now. Either way, if CGI.pm is being preloaded I wouldn't think you would see as much of a hit, since it stays resident in memory and isn't loaded each time the script is called.

    Cheers,
    KM

RE: RE: big performance gain
by le (Friar) on Sep 10, 2000 at 19:59 UTC
    No, I didn't preload CGI.pm, I just said "use CGI qw(:standard);".

    I did this because I wanted to measure the performance of a CGI script that's handed over to Apache::Registry.

      There's a huge performance difference between use CGI and use CGI qw(:standard) because the latter has to make 150 or so symbols through an import, where the former simply loads the "lincoln loader" selfloader and compiles subroutines as needed.

      -- Randal L. Schwartz, Perl hacker

        Following up to my own post, this invocation of the debugger shows just how many symbols were added by CGI:
        halfdome.holdit.com> perl -debug Loading DB routines from perl5db.pl version 1.0402 Emacs support available. Enter h or `h h' for help. main::(-e:1): bug DB<1> x scalar keys %main:: 0 73 DB<2> use CGI qw(:standard); DB<3> x scalar keys %main:: 0 227 DB<4>
        Note that the main symbol table jumped from 73 stabs to 227 stabs. There's work behind this, and that's gonna slow you down a bit. It also takes a lot of space.

        -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2024-04-25 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found