Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

RE: RE: big performance gain

by le (Friar)
on Sep 10, 2000 at 19:59 UTC ( [id://31795]=note: print w/replies, xml ) Need Help??


in reply to RE: big performance gain
in thread Training wheels again

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.

Replies are listed 'Best First'.
RE: RE: RE: big performance gain
by merlyn (Sage) on Sep 10, 2000 at 20:06 UTC
    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

        i only recently took the necessary code out of CGI.pm (i practically only ever needed the part for taking params off a POST-form), and packed it into my own code. not very clean, i know, but Benchmark told me the code with use CGI.pm took 500secs for 1_000_000 iterations, the other one only 3 secs. So... I'm sticking with that.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2024-04-15 12:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found