|P is for Practical|
A more memory efficient storage structure?by JPaul (Hermit)
|on Dec 31, 2002 at 16:04 UTC||Need Help??|
JPaul has asked for the wisdom of the Perl Monks concerning the following question:
I have a piece of code I've been fiddling around with thats designed to emulate natural speech, learning from users input. (Very simply, a learning chatterbox).
I've been surprised by how much memory the data takes up, given how small it is when written to disk.
I use twin hashes, storing practically the same data, but in a different order. The script learns a sentence in two directions (front to back, back to front) so it can generate a sentence in either direction from a given keyword.
For comparison, I write every entry to disk in the format:
Can you fine gentlemonks suggest a better way of storing data in memory, while also being easy to reference?