Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: A more memory efficient storage structure?

by waswas-fng (Curate)
on Dec 31, 2002 at 16:15 UTC ( #223363=note: print w/replies, xml ) Need Help??


in reply to A more memory efficient storage structure?

How do you need to access it? Sometimes you can trade speed for memory by using arrays instead of hashes, also you can tie hashes to dbm files etc greatly reducing the amount of memory you use -- another added advantage here is that your data is saved across multiples runs automagically. check out AnyDBM ans tie

-Waswas
  • Comment on Re: A more memory efficient storage structure?

Replies are listed 'Best First'.
Re: Re: A more memory efficient storage structure?
by JPaul (Hermit) on Dec 31, 2002 at 16:20 UTC
    Greetings;

    Indeed, I never mentioned this point but speed comes first.
    I'm willing to use enormous amounts of memory, right now, because it does respond quickly enough (Generating some 200 sentences in 1 and 1/2 seconds), but if it was any slower than that people using it would probably get frustrated with it.
    This, of course, limits largely what can be done - but I'm still curious if there are solutions to be found.

    JP,
    -- Alexander Widdlemouse undid his bellybutton and his bum dropped off --

      You might want to read perlguts, then. :) If speed comes first, be prepared to burn lots of memory. Speed does not rule out a DB-backed solution, however, as they all do caching and will be rather fast (though probably not as fast as all-memory hashes) once the caches are populated.

      Consider using Devel::Size as you try different things to get an accurate (as long as you don't have coderefs in your hashes) reading of memory used by the different structures.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://223363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2023-09-22 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?