The first suggestion that comes to my mind is to ditch XML::XPath and replace it with XML::LibXML. That will speedup your code, and you will be using a module that is actually maintained.
Then of course the //pair[@id = '.$n.'] is a big red flag. Especially as you seem to be doing this twice for each $n (it's hard to tell as your code is not indented). Either try to have the complete path above pair, or do the search on //pair only once, cache the results in a hash id => node and use this in the rest of your code. Does this make sense?
In reply to Re: my xml xpath is too slow.
by mirod
in thread my xml xpath is too slow.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |