On May 17, 2007, at 2:51 PM, Bill Kelly wrote: > From: "ara.t.howard" <ara.t.howard / gmail.com> >> On May 17, 2007, at 12:48 AM, Bill Kelly wrote: >>> Essentially I'm looking for something that acts like a ruby Hash, >>> is nearly as fast as a ruby Hash, but is persistent. It should >>> also be able to remember gigabytes of information on disk, while >>> not using a ton of resident RAM in the process. >>> >>> Also, when I restart the ruby process, the overhead when >>> initially "connecting to or opening" this persistent hash should >>> be very minimal before I can start using it. >>> >>> Does such a beast exist? >>> >>> From what I've read, it seems like the Berkeley DB might fit the >>> bill; although I'm a little worried I couldn't find the cost of >>> a commercial license listed anywhere on the website. >>> >>> Are there other options besides BDB? >>> >> cfp:~ > cat a.rb >> require 'yaml' >> require 'time' >> ### *nix AND windblows. built-in to ruby >> DB = >> begin >> require 'sdbm' >> SDBM >> rescue LoadError >> require 'dbm' >> DBM >> end >> db = DB.new 'db' >> > > Hi ara, > > Thanks, I've never tried 'dbm'. I'll give it a shot. on linux it's basically just a tiny layer on bdb - but it gets built by ruby automatically > > I've tried 'sdbm' on both Perl and Ruby, and it was horribly > horribly bad. Even with about 20,000 keys, using small-sized > keys and values, the database would bloat up to several > gigabytes and start failing to store new keys. When using > larger sized values, it would fail more rapidly. And the > max-sized values that would work at all seemed to be around > a couple KBytes. (These issues occurred on both windows and > unix... however it seemed to have additional serious issues > on windows. This was a few years ago...) > > Hopefully 'dbm' is better. I'll test it out tonight. > > oh. it has to work!? picky! at least it has cross-platform failure going for it! ;-) -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama