Patrick, In your step #3 - if the list is kept in descending order [i.e. bottom-to-top] you can happily employ a single MVCL as it won't be overlapping. Of course, your binary search needs to know the order is descending.
HTH, -Victor- ======================================================== Date: Mon, 23 Aug 2010 10:45:31 -0400 From: Patrick Roehl <[email protected]> Subject: Efficient Memory List I'’m looking for advice on how to handle a potentially large list of data. The list is comprised of 4-byte entries and the application needs to know if an incoming item is already present or is new to the list. This is the approach that is currently in use and that I’d like to improve upon: 1) Perform a binary search and process no further if the item is already present 2) If there is not enough room to add a new entry, allocate a new storage area 1.5 times the size of the old area, MVCL the existing data to the new area, and free the old area. 3) The binary search from step 1 indicates where the new entry should be inserted. To add the entry to the list, individual entries are moved one at a time (to avoid overlapping moves) to open a spot in the list for the new entry. This old process has worked well for fairly small lists but I’d like opinions on how to improve this process for large lists (say, a million or more). Using SORT is not an option because of the multi-threaded online environment (it’s running in CICS). The list is only used by a single process that handles data as it arrives. To process correctly, it must be able to determine immediately if the data being presented has already been processed. When all of the incoming data for that process has been handled the list is discarded. Speed and efficiency are important. All suggestions regarding logic and coding techniques are appreciated! This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.
