I see that you can insert records into the pdb in a specific location.
Would it be faster to determine where the record goes and insert it that it
would be to append it to the end of the pdb and resort the entire pdb every
time? I think so but wanted another opinion.
Thanks.
Peter Epstein
Yes it is faster to insert the record in place. When you use
DmFindSortPosition, it does a binary search to find out where the record
should be inserted. Then when you insert it into the DB at that point, I
believe there is just some info that is modified in the DB header. In any
case, the
Dane Avilla is absolutely correct. While it's true that the actual insert is
a linear time operation, in practice it's quite fast.
Typically, apps keep their databases sorted in the order the records are
presented in the user interface, which may vary depending upon user
preference.
--
Peter
Does anyone know of any information regarding performance of Palm PDB access
function calls. Are there any ways of structuring data to optimise record
access and data retrieval speed?
Thanks
Glenn
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
In a nutshell: Finding records by unique ID is slow (linear). Finding
records by index is fast (almost constant time). A binary search API is
available that'll give you log time if you keep your records sorted by the
search criteria. Of course, re-sorting your database is slow (n log n).
--