Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: Re: Re: Re: RFC refactoring

by tachyon (Chancellor)
on Feb 15, 2002 at 15:48 UTC ( #145702=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Re: RFC refactoring
in thread RFC refactoring

Actually you completely fail to understand how works. When you use CGI; you import 0 methods. The methods are available via the OO interface and compiled on demand. When you use CGI qw/:cgi/; you import and compile the basic cgi methods (which you would otherwise not do with a straight use CGI;). As we are making OO calls this is a complete waste of time. Running your example you can see that the time remains essentially the same as expected (loading the extra methods once (with the use CGI qw/:cgi/;) adds about a second to the load time but this is a once off price and we are then looping.

use Benchmark; use CGI qw/:cgi /; use CGI::Simple; $ENV{'QUERY_STRING'} = 'foo=bar&baz=boo'; $q = new CGI; $s = new CGI::Simple; timethese(250000, {'CGI' =>'$q->param("baz")', 'Simple' => '$s->param( +"baz")'}); __DATA__ Benchmark: timing 250000 iterations of CGI, Simple... CGI: 29 wallclock secs (27.53 usr + 0.00 sys = 27.53 CPU) @ 90 +81.00/s (n=250000) Simple: 10 wallclock secs ( 9.99 usr + 0.00 sys = 9.99 CPU) @ + 25025.03/s (n=250000)




Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://145702]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2017-04-30 03:14 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (534 votes). Check out past polls.