Suggestions for speeding up my program? (RESOLVED)
I have a program that is running extremely slow. I need some suggestions on how to speed it up. While it will probably run somewhat slow because of the number of records, I fear that I may not be using the fastest possible logic/code. The program basically consists of 2 tables in an Access to Informix database link and two pipe delimited text files. The text files have roughly 23000 lines in them a piece and the tables have roughly 30000 records in them a piece. Here is what the program does:
1. Reads the first record of table 1 in.
2. Tries to find a matching record via primary key in table 2.
3. Tries to locate the records primary key in file 1.
4. If not found in file 1, tries to find it in file 2.
5. If it isn't in either file, deletes the record from the database.
6. Moves onto the next record in table 1.
I use a few for/next loops and I try to break out of any loop whenever I can. It takes roughly 3 seconds per record, and I currently only look in file 1! At 30000 records, that's 25 hours to complete the process. Doubling that by adding in the search for file 2. That's 50 hours. That's a long time!
I think that the slow part is finding the records primary key in the files. I am reading it in line by line. I am hoping there is some quicker way to search for a string in a text file and just return whether or not it is there.
Thanks for any help. If requested, I will post the code if it helps. Thanks again!
shootsnlad