Hi--
I have this 3-level HoH that I would like to print using XML-Twig. The hash stores a fair amount of info (about 20MB over 14K rows) and I am able to print it out by using XML-Twig to build the whole tree then printing that tree.
Something like:
foreach key (keus %hash)
some data manipulation
build some XML nodes onto tree
foreach key2 (keys %{$hash{key}})
some data manipulation
build some XML nodes onto tree
foreach key2 (keys %{$hash{key}{key2}})
parse some prepared XML snippets
graft onto tree
end
end
end
tree->print
This works fine and dandy, but as my hash is getting more and more rows, the slower and slower it runs. Plus the memory allocated goes through the roof, and lately, I've been getting segmentation faults (out of memory is a guess).
Is there a way using XML-Twig to flush(?) the output at the end of a loop step to create the output tree as it is looping through, vs. holding the entire tree in memory before commencing the print?
I've looked around for answers, but most of the Twig tricks are parsing-centric.
Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.