From: "Desenvolvimento 3" <[EMAIL PROTECTED]>
> What�s the best way to perform a search on a pdb?
> I have a list with several products inside that are ordened by their
> product class.
>
I've had good success with pre-built indexes. If your product list
is coming from the desktop and not being modified on the device
this index can be built on the desktop, but even if that isn't possible,
building a product class index each time the database is altered
should provide good speed benefits without adding too much time
to the update.

How the index is built would depend on the number of product
classes relative to the items in each class.  In some instances
where most searches are for the same product group I've used
'lazy' indexes - where the index starts out blank and is populated
by the position of the first item in a class when that class is first
looked up.  This makes the first lookup slow, but subsequent
lookups use the cached position and are immediate.

Another approach is to restructure the database to suit it's use.
For one application with lots of small lookup lists we created each
product class as a single record of packed null-terminated strings.
The entire product class could then be loaded into a list in one call
using SysFormPointerArrayToStrings.  The binary search then only
had to operate on one class per record.

Chris Tutty


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

Reply via email to