http://qs321.pair.com?node_id=737376


in reply to Re: Why oh why is working with XML so bloomin' difficult in Perl?
in thread Modified title: The structures created by many of the XML parsers in Perl appear unnecessarily deep in levels...

I agree here, but I'll add that the time spent learning XML::LibXML will easily made up at run time. XML::Twig is great if you need a pure Perl module, but XML::LibXML will produces results much quicker during run time and isn't as memory heavy.

Replies are listed 'Best First'.
Re^3: Why oh why is working with XML so bloomin' difficult in Perl?
by ikegami (Patriarch) on Jan 20, 2009 at 04:48 UTC

    XML::Twig is great if you need a pure Perl module, but XML::LibXML will produces results much quicker

    XML::Twig is no more Pure Perl than XML::LibXML. Both use C libraries to perform the parsing. It's possible that XML::LibXML is faster, but it's not related to the choice of programming language.

    XML::LibXML [...] isn't as memory heavy.

    That's an odd thing to say. The whole idea of XML::Twig is to keep nothing in memory that doesn't need to be, whereas XML::LibXML keeps the whole document in memory.

      I stand corrected. It has been a while since I installed either, but XML::Twig is a bit easier to install than XML::LibXML.

      I can't agree with your view on the memory aspect. While XML::Twig may to keep nothing in memory, it does get pretty leaky. Then again, It has been a while, and not the latest version.

      Speed wise though LibXML is much faster than Twig. I had to switch our app from Twig to LibXML because documents in Twig were taking close to 5 seconds each, but LibXML was .05 seconds.

        Isn't that a classic trade-off? Pick one: fast or light weight. If you can use up as much memory as you want, finding something should not take a whole lot of time. But if you want to keep your RAM usage down, way down -- you have to spend extra CPU cycles to do so.

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)
        
Re^3: Why oh why is working with XML so bloomin' difficult in Perl?
by ikegami (Patriarch) on Jan 20, 2009 at 04:50 UTC

    XML::Twig is great if you need a pure Perl module, but XML::LibXML will produces results much quicker

    XML::Twig is no more Pure Perl than XML::LibXML. Both use C libraries to perform the parsing. It's possible that's XML::LibXML is faster, but it's got nothing to do with language selection.

    XML::LibXML [...] isn't as memory heavy.

    The whole idea of XML::Twig is to keep nothing in memory that doesn't need to be, whereas XML::LibXML keeps the whole document in memory.