Ron, I am scanning for the last inserted item matching the search-criteria,
not the last inserted item...
not the last inserted item...
A. If you are looking for the last inserted item meeting a criteria, why bother sorting the array at all?
B. Doing a REDIM PRESERVE for *every* insert takes time; better perhaps to allocate new "block" of elements (maybe 100 at a time, using something like REDIM PRESERVE FooArray (1: UBOUND(FooArray) + 100) and keep trak of the number of valid elements.)
C. If "entry sequence" is important to you, it should be part your sort key.
D. If none of these methods floats your boat, I published a linked-list method of keeping a list of UDTs in sorted order by three keys at once. This code is public domain, available at the IMS web site. The December, 1998 issue of "BASICally Speaking" included MS-DOS code along with a detailed explanation of what I was doing in an article entitled, "Make Haste,Not Waste." The April, 1999 issue contained the migration of that code to PB/Win32 in an article entitled, "Dynamic Allocation and Linked Lists: Porting from PB/DOS to PB/CC"
Since the code is public domain it may be posted in the source code forum by anyone. The article texts are copyright; reprints are available from IMS at http://www.infoms.com, follow the links to Basically Speaking.
Bottom line: ARRAY SCAN BACKWARDS may be a neat feature, but just looking at you application I think you have a number of things to try to speed it up without waiting for a new feature.
------------------
Michael Mattias
Racine WI USA
[email protected]
Leave a comment: