http://www.perlmonks.org?node_id=805295


in reply to large XML file in using XPATH

hard to reply to this question: i have no idea if the issue is the algorithm or the memory which swap. I'll go a bit OT and try to suggest you to change completely your approach:

use a SAX parser and collect data while reading the XML only once. This could probably speed-up the process and reduce the mem usage and is a good hint if you are managing huge xml.

HTH

Replies are listed 'Best First'.
Re^2: large XML file in using XPATH
by Anonymous Monk on Nov 05, 2009 at 16:18 UTC
    No idea about SAX, but I know in XPATH every time the loop performed the file is read into the memory so it would take long. and also I cant get all my "wn" and "l" attributes in an array since some of my w elements dont have the attribute "wn" ....
Re: large XML file in using XPATH
by mattk1 (Acolyte) on Nov 05, 2009 at 21:02 UTC
    Some days ago I parsed a 500KB file with XML::XPATH and printed the resulting datastructure with print Dumper .. to a file. I was suprised, because it was 36MB big.