Welcome to the Monastery | |
PerlMonks |
Re: Bidirectional lookup algorithm? (Updated: further info.)by ikegami (Patriarch) |
on Jan 05, 2015 at 16:04 UTC ( [id://1112206]=note: print w/replies, xml ) | Need Help?? |
So you have something like the following:
A copy of the address and of the identifier are stored in the elements of each hash. (The key of an element is stored in the element to distinguish elements in collisions.) You can cut the number of scalars (or is it string buffers?) in half as follows:
Of course, constructing is going to be much slower. I think you can avoid iterating through the hash (and avoid using Data::Alias) by dropping to C, but if you can do that, you could use a C-based data structure and use strings instead of scalars. Update: It seems that only the string buffers are getting shared, not the entire scalar.
In Section
Seekers of Perl Wisdom
|
|