Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: why won't the hash go away?

by snoopy (Deacon)
on Jan 12, 2008 at 23:37 UTC ( #662124=note: print w/ replies, xml ) Need Help??


in reply to why won't the hash go away?

You may want to consider mapping your game states to persistant storage using DBM::Deep(or similar).

Not only do you free up memory; you get free game persistance. Saving and switching between games becomes near instantaneous.


Comment on Re: why won't the hash go away?
Re^2: why won't the hash go away?
by WoodyWeaver (Scribe) on Jan 13, 2008 at 00:17 UTC
    ...but oh, the cost! This is a search algorithm, and the "trick" is to avoid having to search a node twice; the underlying game is "Spider", and there is a lot of repetitions between positions. So the hash lookup gets done *a lot*. By making it a tie, now not only do I have to do something fancy to invoke the tie, but I'm going to be bogged down my disk access.

    Of course, the thrashing means I'm bogged down by disk access as well, so...

      >> but I'm going to be bogged down my disk access:

      Hmm, I'd be interested to see how DBM::Deep plays with open's mmap option (as of yet untested/unbenchmarked):

      open(DATA, '<+:mmap', 'game.dbm') my $db = DBM::Deep->new( { fh => \*DATA } );
      Update: Have benchmarked. No appreciable benefits with the above :-|

      Now looking at the storage => ... option.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-07-23 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (140 votes), past polls