Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

When people talk about linked lists “storing data all over the place,” what they are really concerned about is locality of reference, i.e. minimizing the probability of a virtual-memory page fault ... which involves stopping the process in its tracks, doing a physical I/O to retrieve the page from a spinning disk, then restarting the process where it left off.   If you only do that “occasionally,” as the operating-system strives to enable you to do, then all is well.   But if the number of page faults becomes, and stays, excessive, then the system is “thrashing.”   (The shape of the throughput-curve in a thrash situation is elbow-shaped:   beyond the thrash point, performance for pretty much the entire system degrades exponentially.   As they put it in the movie Ghostbusters, the result is “real Wrath of God stuff.”)

I will admit that I really don’t know how Perl stores a vector, or for that matter, a list or a hash.   Concerns about cache-line misses are beyond my control since they are wholly dependent upon the particular hardware upon which my software might find itself running.   But locality-of-reference is something that I can readily keep in mind, as being something that will very-directly affect the execution of my code far more than the low-level perlguts of Perl’s very highly optimized implementation.

You can build any sort of data-structure you may require in Perl, or, more likely, discover that CPAN has already done it for you.   Red-black trees?   Sure:   Tree::RedBlack or Tree:RB, to name two.

Nearly all of the time, when I stumble upon a failed-program, the manifest symptom of the problem is either a timing-hole or (more likely), thrashing.   The solution is to choose a different algorithm to solve the problem.   By the time I first see it, the code has been “diddled” to the point that it is frankly no longer even readable, and nothing helped.


In reply to Re: Data structures in Perl. A C programmer's perspective. by sundialsvc4
in thread Data structures in Perl. A C programmer's perspective. by code-ninja

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (8)
    As of 2014-08-01 07:05 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (257 votes), past polls