Hello again and thanks for the continued support,

I am building a CGI script to go online, and it is slow, so I used a profiler to find how to make it better. The problem is, I don't know what I could do...

As you'll see, CGI::AUTOLOAD takes the most time (over half)... What does this mean? Is it something I can control?

Secondly is the File::Find. I tried readdir, but it produced similar results. In the works is eliminating the need to loop through files (by making one large file), I hope this will make it more efficient.

Here is part of the output (I doubt you guys need the whole thing) from one test by Devel::Profile :

time elapsed (wall): 27.9298 time running program: 27.9106 (99.93%) time profiling (est.): 0.0192 (0.07%) number of calls: 4170 %Time Sec. #calls sec/call F name 73.95 20.6410 7 2.948712 CGI::AUTOLOAD 25.48 7.1128 3626 0.001962 <anon>:...Perl/5.10.0/File/Fin +d.pm:717 0.27 0.0746 1 0.074612 File::Find::_find_dir 0.08 0.0216 1 0.021615 <anon>:...bles/mytestsearch201 +1.cgi:25 0.05 0.0142 7 0.002028 CGI::_compile 0.05 0.0131 0 0.013137 * <other> 0.04 0.0113 1 0.011286 <anon>:...y/Perl/5.10.0/CGI/Fa +st.pm:18 0.01 0.0029 1 0.002868 <anon>:...ibrary/Perl/5.10.0/C +GI.pm:27 0.01 0.0025 71 0.000035 main::dependency_checks

And I tried using Devel::FastProf, which gave me this output (-p was used)(Again, only a portion):

/System/Library/Perl/5.10.0/CGI.pm:867 22.53873 1: [at line 10 inside +eval] ??? /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:139 7.02436 11 +7492: next unless ($sentblock =~ /\b$verbform\b/i); ##Ensure the sent +ence contains the searchkey /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:123 0.86092 51 +9: while (my $sentblock = <FILE>) /System/Library/Perl/5.10.0/File/Find.pm:895 0.61021 150: @filenames = + readdir DIR; /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:134 0.22259 29 +373: $sentence =~ s/, / /g; /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:131 0.08909 30 +413: next unless ($sentblock =~ /\[sent. (\d+) len. \d+\]: \[(.+)\]/) +; ##Remember, talking about the whole block here /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:126 0.05230 30 +413: if ( $sentblock =~ /file:\s(\S+)\.txt/) ##Could change to get ju +st chpt number/word /System/Library/Perl/5.10.0/File/Find.pm:940 0.03863 3625: $sub_nlink += (lstat ($no_chdir ? $dir_pref . $FN : $FN))[3]; /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:27 0.03166 1: +require '/Users/jon/Desktop/stanford-postagger-full-2011-04-20/verbTe +nseChanger.pl'; /Library/WebServer/CGI-Executables/mytestsearch2011.cgi:132 0.03129 29 +373: $sentencenumber = $1; ## $1 refers to first set of paranthesis i +n the last match

Hope you can help.


In reply to Benefiting from Devel::Profile or Devel::FastProf by jonc

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.