I have written a program that works reasonably well, however, I am pretty sure there is a way to speed it up.
Initially, I wrote it without the threading set up from below (although that said, I have a feeling that the threading set up below is having no effect at all).
I will say up front, I am totally new to threading, processing or any performance improvements to my code.
I was hoping that someone could run their eye over the below snippet and see if there was a way that I could implement something to run parallel threads/processes etc. (in summary to speed it up or at least process more files at once)
I also am having troubles trying to get any other performance speed ups to work with the nested for loop below:
for file in files:
for IPAddress in IPAddresses:
- files - is a list of (gzipped) files
- IPAddresses - is a list of IP Addresses
if __name__ == '__main__':
files = [
'file1',
'file2',
'file3'
]
IPAddresses = [
'1.1.1.1',
'1.1.1.2',
'1.1.1.3'
]
threads = []
for file in files:
for IPAddress in IPAddresses:
t = threading.Thread(target=Search_files(file, IPAddress))
t.start()
threads.append(t)
print('file: ' + file + ' processed for IP Address: ' + IPAddress.upper() + '\n')
for thread in threads:
thread.join()