You might want to rethink how you search the records, and binary search is your friend but your key will need to be sorted.
I have a 15k records db and the average search is about, IIRC, 6ms. elv "Richard Coutts" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My database has typically 300 or so records where each records is from 100 > byts to 65535 bytes long, with the typical size being around 10,000 bytes. > The first 20 or so bytes of each record is a table that describes what's in > the rest of the record, so when searching the database I often only need to > load the first 20 bytes of the record to determine if the remainder of the > record needs to be loaded. > > I did it this way to speed up searching the database, but it still is taking > a surprisingly long time. E.g., I'm averaging around 10 records per second, > which means it takes about 30 seconds to load the first 20 bytes of 300 > records on a Tungsten E. > > I'm wondering if I'm doing something wrong or if there's a way to speed > things up. To load the first 20 bytes of each record, I loop through and > open each record like this: > > for (index = 0; index < numRecs; index++) > { > recHandle = DmGetRecord(dbHandle, index); > // get the recID (need this later) > DmRecordInfo( dbHandle, index, NULL, &recID, NULL); > // get the buffer > buffer = (char*)MemHandleLock(recHandle); > : > // do other stuff here to see if we need to search the rest of the > record > : > MemHandleUnlock(recHandle); > } > > Thanks, > Rich > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
