in reply to Moving from hashing to tie-ing.

I can't reproduce this sensibly on my machine (32G of memory being too much to stress-test). But my idea is this: You could split the pins into large groups e.g. based on the first four digits and put each group in a Storable. Then maintain a hash of objects that references all the storables - this hash will only have 10000 keys max. This might be enough preparation for the machine's own VM architecture to resolve the problem for you.

If not, enhance this with a fixed-length league table (of length 1000 * memory-limit/2.5G: 1000 instead of 10000 to allow for uneven grouping of pins) in an array of array of recently-accessed storables and their hit counts and do your own virtual memory management of the 10000 or so stored hashes on that basis (can refine this by including timestamps i.e. hit ageing factor) - it's what a DBMS would do for you anyway, but such a targeted solution will perform faster than a general-solution DBMS.

-M

Free your mind