Filtering(searching) data is done by manually going through each and every
entry and decide if that particular row is to be displayed or not. To
display, I would just give it a normal cell height, if I need to hide it, I
just set the cell height to 0. I've decided to not use substr to filter the
data as substr is very slow, so the algorithm to filter is to compare the
entry with a search key character by character.
As the user enters the characters of the filter(search) key, the program
goes through all visible entries checking if the newly entered character is
the same as the character in the entry at the same position.
Deleting characters from the search key involves searching the hidden
entries and checking if the entry starts with the search key. This is done
by retrieving the left portion of the entry that has the same length as the
remaining search key and doing a match. A match would unhide the entry.
With this algorithm, I could reasonably search 8000 entries but as the
number of entries increases the search time exponentially increases to the
number of entries. Is there a way of improving the algorithm so that the
search becomes faster? Should I be using other controls? Are there any
libraries that I can use to improve the efficiency of the algorithm? I need
the algorithm to be able to reasonably search 40,000 to 50,000 entries. Many
thanks in advance.
I love doing this from a SQL query, it is very fast and shows only the items
that are like what the user is typing. Putting the data into a simple Jet
database might be worth the added effort if the program is expected to
perform well on a large set of data. All of the components of the database
can be self contained in your program and operate on a single MDB.