in reply to Re: Re: How to change referent of lexical reference?
in thread How to change referent of lexical reference?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: How to change referent of lexical reference?
by autarch (Hermit) on Sep 23, 2003 at 04:39 UTC | |
by BrowserUk (Patriarch) on Sep 23, 2003 at 06:49 UTC | |
by autarch (Hermit) on Sep 24, 2003 at 16:12 UTC |