Fine. For your edification.

speedtest-cgi-minimal.pl

#!/usr/bin/perl use CGI::Minimal; my $value = CGI::Minimal->new->param('a'); print "Status: 200 OK\015\012Content-Type: text/plain\015\012\015\012a + = $value\n";

speedtest-cgi-pm.pl

#!/usr/bin/perl use CGI; my $value = CGI->new->param('a'); print "Status: 200 OK\015\012Content-Type: text/plain\015\012\015\012a + = $value\n";

I ran the test both with them hardlinked from the first @INC directory and then again with them in only their normal locations. The test was a 60 second run with 30 parallel fetches of http_load of each on a P4 with hyperthreading enabled at 3.06 GHz (I used a second fast machine to execute http_load for the requests). The version of Apache was 2.2.2 and the version of Perl was 5.8.8.

in first @INC Directory Normal CGI.pm (3.25) 21.5/second 21.5/second CGI::Minimal (1.26) 73.8/second 73.6/second

The difference is below the system noise floor. Any other criticisms of my methodology?

My 'irrelevant' statement point was that it doesn't really matter a whole lot that if CGI.pm didn't do its clever little trick with subroutines stored in hash strings that it would be even slower than it is right now. It still is measured to run much slower than any of the alternative CGI parameter processing modules and that difference is simply due to its raw size.


In reply to Re^5: Why can code be so slow? by snowhare
in thread Why can code be so slow? by freakingwildchild

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.