Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Is it wiser to move on from XML::Simple to XML::Compile ( XML::Hash::XS )

by Anonymous Monk
on Jan 27, 2014 at 08:59 UTC ( #1072189=note: print w/ replies, xml ) Need Help??


in reply to Is it wiser to move on from XML::Simple to XML::Compile

I want to know if i am doing things correctly and is XML::Compile really slow?

You appear to be doing things correctly ... if all the modules do what you want with the code you included

And yes, XML::Compile is probably that slow :) OTOH it does more than the other modules (and does it in perl code), so the slowness isn't unexpected

See http://www.xmltwig.org/article/simple_benchmark/

As the results have to be displayed to browser performance is a big issue.

Blah blah blah ... "loading data" spin cursors were invented for a reason :D

Please advice..

My advice (that I'm advising you with) is to try XML::Rules its XML::Simple on steriods :)

Also, profile your code (nytprof) to identify other bottlenecks :)

Also try XML::Hash::XS -- its libxml2+xs -- should be as fast as you can possibly get

See also http://xmlbench.sourceforge.net/results/benchmark200910/index.html

Good luck


Comment on Re: Is it wiser to move on from XML::Simple to XML::Compile ( XML::Hash::XS )
Re^2: Is it wiser to move on from XML::Simple to XML::Compile ( XML::Hash::XS )
by mohan2monks (Beadle) on Jan 27, 2014 at 09:26 UTC

    Thanks for reply.
    I did check XML::Rules first, need to explore it further.
    Did profile and found two bottlenecks

    1. Waiting for web service to reply (if it can be called bottleneck of code Nytprof does not consider IO waiting time )
    2. Time Taken by XML::Simple
      # spent 66.0s (147ms+65.9) within XML::Simple::XMLin which was called: + # once (147ms+65.9s) by main::RUNTIME

      XML::Rules might be slightly quicker than XML::Simple, because it doesn't try to guess what would be the best way to convert the XML into a data structure, but that's not the main reason you should switch. The problem with XML::Simple is that (even if you do specify some options) the datastructure it generates is not consistent. Things like optional attributes and repeated tags may cause hard-to-handle inconsistencies. Well set XML::Rules will give you a consistent datastructure and allow you to ignore and skip data you are not interested in. This may lessen the memory footprint and speed things up.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1072189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-12-29 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (187 votes), past polls