Perl Monk, Perl Meditation | |
PerlMonks |
Re: Libxml parser cosuming 100% cpuby Jenda (Abbot) |
on Aug 11, 2018 at 15:04 UTC ( [id://1220257]=note: print w/replies, xml ) | Need Help?? |
What the fsck?!? You choose to use a gulp-everything-and-transform-into-insane-maze-of-objects style XML parser, find out it's gonna choke on your document so you devise a "solution" that attempts to guess where the chunks end and then you fire the parser a thousand times to somehow handle it and quite possibly forget to clean the buffer so you end up parsing the same stuff over and over and over again? And just so that you waste more memory you first load the document into an array of lines? Seriously? Do yourself a favour, scratch the array and the loop, forget about XML::LibXML and use a parser that will let you handle the file in chunks. Say XML::Twig or XML::Rules. getChildrenByTagName, sweet jeesus! By the way, it's cute that you have stovky tisíc lines. Jenda
In Section
Seekers of Perl Wisdom
|
|