XML::XPath time consuming

Z

zero1979

Hi,

I have started working with use XML::XPath everything is fine but one
thing is not so good. It is time consumed by script that I have
written. I tested it and it occured that the main problem is with
method find (and its variations) from use XML::XPath.

Maybe there is any quick solution to speed up reading from XPath?
 
M

mirod

zero1979 said:
I have started working with use XML::XPath everything is fine but one
thing is not so good. It is time consumed by script that I have
written. I tested it and it occured that the main problem is with
method find (and its variations) from use XML::XPath.

Maybe there is any quick solution to speed up reading from XPath?

The best solution, if you can (ie if you can install libxml2) is to
switch to XML::LibXML. The code should be nearly the same, both modules
build a DOM, implement the DOM API (XML::LibXML's support being more
complete) and give you XPath on it. The only differences shouls be the
construction of the object and the method used to get the text of an
element (string_value instead of textContent). This will give you a huge
speed boost , probably an order of magnitude faster (see the benchmark
at the end of
http://xmltwig.com/article/ways_to_rome/ways_to_rome.html).

Otherwise you can see if you can speedup your XPath expressions,
essentially by trying to eliminate the use of the descendant axis (//).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,055
Members
47,659
Latest member
salragu

Latest Threads

Top