Hi,
I have a program that does the following: given a directory as it's only argument, it goes to that directory and looks for directories inside that contain 2 special types of very large files. If it finds these files, it goes through each file line by line looking to see if they contain certain strings. As mentioned, these two files are very big and contain a lot of information, and I recently ran this program on a certain directory and it took 35 minutes to complete. I've optimized the algorithms as much as I can using binary search to compare each line for each value that I'm looking for (don't want to implement a hash table for this particular program). My question is this, would it be faster for me to use the 'grep' command to look for the information im looking for, rather than opening each file and going line by line, or would it even make a difference?
KiSSz
I have a program that does the following: given a directory as it's only argument, it goes to that directory and looks for directories inside that contain 2 special types of very large files. If it finds these files, it goes through each file line by line looking to see if they contain certain strings. As mentioned, these two files are very big and contain a lot of information, and I recently ran this program on a certain directory and it took 35 minutes to complete. I've optimized the algorithms as much as I can using binary search to compare each line for each value that I'm looking for (don't want to implement a hash table for this particular program). My question is this, would it be faster for me to use the 'grep' command to look for the information im looking for, rather than opening each file and going line by line, or would it even make a difference?
KiSSz
Comment