Jim Cooper wrote:

I am developing an app. that will store approx. 500,000 contacts.


Are you sure this is an appropriate thing to do on a Palm (or any PDA)?

If each contact has only 4 fields (first name, last name, phone number and email), the database will need 2M just for the null terminating bytes. Even on a 16M device, each record can average only about 32 bytes ( minus the terminating bytes) of data. So for the four field example each field will be on average 7 bytes. And that's a more efficient form of storage than your fixed field width suggestion.

It's still probably possible to make it work, but it will take more work. You could use some form of compression. For storing lists of contacts, huffman might work pretty well, even static huffman where you have a different fixed table for each field. (The phone number field would have shorter codes for numbers and null terminator, the first and last name fields would have shorter codes for letters, etc.) Obviously, null terminators would occur quite frequency and so should have a pretty short code (4 or 5 bits). If you could get a 2-to-1 compression ratio through huffman coding, you'd be able to store 15 characters of stuff per field plus null terminator in 16MB.

I'm sure you could get even better results with zlib and breaking
everything up into blocks of about 16K or 32K.

Syncing will likewise take forever. Even if you pack many logical records in to one physical record, just transferring that much data is going to take ages.

Yes, there's probably no getting around that without some really elaborate means like keeping a transaction log on both handheld and desktop and then transferring the transaction logs through a custom conduit during hotsync. Which would be messy!

So, I agree, it would be tough to do this on the Palm, but it's
not necessarily impossible.

  - Logan

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to