Exactly what I was going to suggest. If you don't want to go through the overhead of mapping your data structure(s) to disk files, the earlier post suggesting Tie::MLDBM combined with a RAMdisk would only add the overhead of going through the OS's disk routines, which have probably been subjected to some optimization already.