Sorry about that, though if your original question had been stated as clearly as here, then it might have saved a few false impressions:)

The best suggestion I can make is that you keep a hash, with frozen copies of the in-memory datastructures that might match as the keys, and a reference to them as the values.

When you import a frozen datastructure, you then just look it up in the hash and if you find a match, set the pointer to the new one to the value from the hash, and there would be no need (or point) in asking Storable to thaw the inbound structure. If not, just thaw() as normal.

This would mean maintaining the frozen copies as the get modified, but this could be easily done by tieing the structures that make up each compound structure, and updating the frozen copy, cash hash on STORE.

This arrangment would make for fast isolation of matching structures at the expense of the overhead of re-freezing when elements of the structure are updated.

If you really wanted to trim that overhead, you could start playing games with arrays of lvalue refs into the frozen copy and overwrite individual fields, packing the data yourself, but this would require some effort to set up for the general case and you'll probably consider that overkill.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: Re: Re: How to change referent of lexical reference? by BrowserUk
in thread How to change referent of lexical reference? by autarch

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!
  • 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:
    & &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.