Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

It seems you have misunderstood my posting, perhaps it was a little bit short on information.

I did not run NYTProf once or twice to see that factor 30. I ran NYTProf after every little change, to see if that change was accelerating my script or not, and to find the next hot spot in the code. Some changes had little or no effect, some even slowed down. Most changes gained only some percents. The two big winners were the traversing code and XML::Twig.

Removing the traversing code already accelerated my script. Some smaller steps followed, but then the next problem became quite obvious: XML::Twig burned a lot of time when creating new elements and attributes. I replaced XML::Twig with XML::LibXML instead of hacking XML::Twig simply because it was easier than creating a private branch of XML::Twig fine-tuned for my special case. It was a reversable test, because I had the latest version of the script using XML::Twig in SVN. If XML::LibXML had been as "slow" as XML::Twig, I could have simply issued a "svn revert" and could have continued by optimizing a private branch of XML::Twig. This replacement was mostly a quite simple search-and-replace operation for the different class and method names, but it gave an instant performance boost of several hundred percent. So I commited that version and never thought about going back to XML::Twig. The one thing I lost was the really useful "csv" indent style available in XML::Twig output, but I added that back later using some perl code. After replacing XML::Twig with XML::LibXML, I found and reworked some other routines wasting some time, but compared to the tree traversing code and XML::Twig, they were nearly insignificant. Now, the script is sufficently fast and spends most time in code that I can not optimize further (Perl opcodes and libxml xsubs).

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^4: web performance 2010 by afoken
in thread web performance 2010 by cutlass2006

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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: (5)
As of 2024-04-25 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found