Bill Kelly
11/3/2006 2:10:00 PM
From: "PWR" <pw_richards@fastmail.fm>
>
> snacktime wrote:
>> On 11/2/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
>> > On Fri, 3 Nov 2006, PWR wrote:
>> >
>> > > I am using Ruby 1.8.2 on Windows and am wanting to use the dbm library
>> > > but cannot seem to find it anywhere. Can anyone please tell me where I
>> > > can find this package?
>> >
>> > it comes with ruby.
>> >
>> > harp:~ > ruby -r dbm -e' p DBM '
>> > DBM
>>
>> With ruby 1.8.5, there is no DBM on windows, it's SDBM or GDBM.
>
> Thanks, that's solved it. I am now using SDBM.
Warning, unless something's changed since I last tried SDBM
on Windows a few years ago... It has some severe limitations.
(It wasn't a Ruby problem, Perl uses the same SDBM library and
exhibits the same issues.)
For ex... This test program tries to write a million key/values
to an SDBM store, where the key length is 8 bytes, and the
value ranges from 1..512 bytes:
require 'sdbm'
k = 12345678
SDBM.open("test.dbm") do |dbm|
1000.times {|iter|
1000.times {
dbm[k.to_s] = "v" * (rand(511) + 1)
k += 1
}
print "#{iter} "
}
end
On my system (win xp pro, NTFS) it only makes it to around
40,000 to 50,000 keys before blowing up with:
dbmtest.rb:9:in `[]=': sdbm_store failed (SDBMError)
And the .pag file size has bloated up to 1.7 to 2.1 gigs at
the point it dies.
Anyway, just FYI... if you program needs to store a lot of
key/values, SDBM may not be able to handle it...
Regards,
Bill