[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] DB_File File Size



In article <199904270717.DAA18174@exponet.net>, matt@exponet.net writes:
> Dear Richard,
>> The corresponding code which worked for me, using DB_FILE, and which led to
>> sensible file sizes, was:
>> 
>> >	$Entries     = {} ;
>> >	$EntryFile   = "whatever" ;
>> >     tie %$Entries, "DB_File", $EntryFile,  O_RDWR|O_CREAT, 0640,
>> $DB_BTREE ;

> The one thing present in your code, that wasn't present in mine, is the 
> $DB_BTREE attribute after the permissions in the TIE statement. I inserted 
> $DB_BTREE in my original code, and the DB file size shrunk from 2.5MB to 120k-- 
> much more reasonable!

> Do you know what the $DB_BTREE attribute does, and whether that's portable 
> between UNIX and the MacOS?

DB_BTREE stores the data in a B-Tree (Balanced n-ary tree, sorted by key)
instead of a hash table. I know that the hash code had in some versions a
problem with file systems whose block sizes were not an even power of two,
while the B-Tree code doesn't have this. I thought I had this fixed for 5.2.0,
but maybe I hadn't.

Yes, DB-BTREE works everywhere that DB_FILE works.

Matthias

-- 
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "One fine day in my odd past..." -- Pixies, _Planet of Sound_

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org