Hi ,
I tried to optimize my file hiXMLDOMParser.pm which i am using
use XML::DOM;
I tried to take profiling using Apache::SmallProf ,and i got
XML::DOM.pm.prof under /opt/hiweb/server/logs/smallprof
Then i used
smallprof> sort -nrk 2 XML::DOM.pm.prof|more
1 0.054982 0.050000 537: push (@EXPORT, qw(
3 0.038814 0.030000 3418:use XML::DOM::DOMException;
3 0.035562 0.030000 2457:use Carp;
3 0.035379 0.030000 3815:use XML::DOM::NamedNodeMap;
3 0.035119 0.010000 1961:use Carp;
2 0.033434 0.030000 4325: );
49 0.027702 0.010000 179: eval "sub $pkg\::_$_ (
+) { $i }";
1 0.026273 0.010000 529: require FileHandle;
3 0.023238 0.020000 161: no strict 'refs';
3 0.021779 0.010000 4270: use LWP::UserAgent
+;
85 0.021420 0.030000 186: ${"$pkg\::EXPORT_TAGS"}{Fi
+elds} = [
map { "_$_" } @f ];
3 0.020408 0.020000 1432:use Carp;
3 0.020397 0.020000 526: use XML::DOM::DOMException;
3 0.018287 0.010000 1286:use Carp;
1 0.017862 0.010000 41: require XML::Parser;
3 0.017679 0.010000 2182:use Carp;
3 0.017392 0.020000 1665:use Carp;
3 0.016083 0.000000 37:use XML::RegExp;
3 0.016081 0.000000 2456:use XML::DOM::NamedNodeMap;
3 0.014647 0.010000 2854:use Carp;
3 0.014504 0.000000 1542:use Carp;
which displays in order
<num> <time> <ctime> <line>:<text>
when i noticed use carp was called 3 times in an file,in turn
85 0.021420 0.030000 186: ${"$pkg\::EXPORT_TAGS"}{Fields} =
map { "_$_" } @f ;
was called 85 times.
May i know the reason why this has been called for so many times,and also how to reduce number of calls in my code,reduce 3 calls to one as well as 85 times to some reduced time.Can any one help in this regard.
Thanks,
srini.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.