Here's a little bit of background: I have an object
Node that is, at its core, now a blessed anonymous hash. The hash contains keys
first_daughter,
last_daughter,
next_sister,
previous_sister and
parent, the values of which are references pointing to other such nodes. (The nodes are contained within a
Tree object, which is a blessed anonymous array.) I've found that with large-ish trees - my testcase has 427 nodes - traversals, for example recursively going
first_daughter->next_sister from root to tips where on every step the reference is retrieved through an accessor method, becomes somewhat slow.
So the question is whether it would help to have the references stored in an anonymous array? As you suggest, I'll probably try it out anyway, but I was wondering if anyone has any experience with this kind of structure & method and whether they can say it is or isn't worth the trouble. A hash is certainly easier to remember than keeping track of the array indices for the various getters & setters.
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.