I've made some mix between them and optimized the logic and arithmetic - now 30000 records are sorted in less than half a second on T|C :)
Richard Coutts wrote:
MemHandleLock is surprisingly slow function. I've benchmarked it many times and got awful results - it was a times slower than everything else in my program. I found no way to avoid it - even if I use the the handle as a pointer to pointer (and the value it points is the actual value I receive from MemHandleLock) I'm getting fatal alerts. So the only way I found is to make a FtrPtrNew at the start of the program, lock all the records and store the pointers in this feature memory, then unlock back at the end. Sad but true.
I've found the same thing to be true. E.g., when doing a bubble sort of a few hundred records, the constant locking and unlocking of records really slows things down quite a bit. But, if I lock all of the records first, do the sort, and then unlock them, its much faster (maybe 3-5 times faster, though I've never done any timing tests).
Rich
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
