Well, the code is about as simple as can be... so it might be hard to simplify it.

The first thing to try is to see if it is really XML::Twig causing the difference or if it is XML::Parser: try perl -MXML::Parser -e'XML::Parser->new->parsefile("rrd.xml")' and see if parsing time is similar on the 2 machines or not. then you can try adding dummy handlers to the parse, to see what's going on.

Is there a big difference in the amount of memory on the 2 computers? A 12Mb file should translate into something like 150Mb in memory, depending on the amount of tagging in the XML.

Then, do you really need to process all of the data? if not using twig_roots would reduce the memory needed and possibly speedup the code (if you skip big chunks of the data).

If you find something that explains the difference I would be very interested in knowing about it, thanks.


In reply to Re: XML Parse performance by mirod
in thread XML Parse performance by Anonymous Monk

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.