From: Rob Dixon <[EMAIL PROTECTED]> > Prabu Ayyappan wrote: > > > > I want to convert a huge XML file into an inMemory Hash. > > > > I tried using XML::Simple. But its taking huge memory space and time to > > convert it into Hash. > > > > While loading a XML file of 300MB its taking more memory space and time. > > > > Is there any better method to load this XML to memory ? > > > > Is there any benchmarks available ? > > If your file is huge and you want it in memory then you must expect it to take > take a while to parse and occupy a huge memory space. Almost anything is > better > than XML::Simple, but no module can easily make your data any smaller.
Actually not. Almost any other module that parses the whole file and then gives you the data will take up more memory. XML::Simple ignores a lot of the details that it thinks are unimportant and produces a farily minimal structure with no links to siblings, no complex blessed structures etc. You'd need to use something that gives you more control over the generated structure, so that you can skip unimportant tags and attributes etc. (Yeah, shameless plug. XML::Rules) > You should > reassess your solution to see if you can work with only part of the data in > memory. > I suggest you look at XML::Twig for processing XML in chunks. Agreed. If you can work in chunks you'd definitely need much less memory. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/