You can get acceleration, depending on the number and size of your files. See this answer to a similar question: Efficient reading of files in python with the need to split into "\ n"
Essentially, you can read multiple files in parallel with a multi-threaded, multi-processor, or other way (like an iterator) ... and you can get acceleration. The simplest thing is to use a library like pathos (yes, Iām the author), which provides multiprocessing, multithreading and other parameters in one common API - basically, so you can code it once and then switch between different backends until you have what works fastest for your case.
There are many options for different types of maps (on the pool object), as you can see here: Python Multiprocessing - monitoring the process of pool.map .
While the following examples are not the most figurative examples, it displays a double-nested map (equivalent to a double nested loop) and how easy it is to change internal and other parameters on it.
>>> import pathos >>> p = pathos.pools.ProcessPool() >>> t = pathos.pools.ThreadPool() >>> s = pathos.pools.SerialPool() >>> >>> f = lambda x,y: x+y >>> # two blocking maps, threads and processes >>> t.map(p.map, [f]*5, [range(i,i+5) for i in range(5)], [range(i,i+5) for i in range(5)]) [[0, 2, 4, 6, 8], [2, 4, 6, 8, 10], [4, 6, 8, 10, 12], [6, 8, 10, 12, 14], [8, 10, 12, 14, 16]] >>> # two blocking maps, threads and serial (ie python map) >>> t.map(s.map, [f]*5, [range(i,i+5) for i in range(5)], [range(i,i+5) for i in range(5)]) [[0, 2, 4, 6, 8], [2, 4, 6, 8, 10], [4, 6, 8, 10, 12], [6, 8, 10, 12, 14], [8, 10, 12, 14, 16]] >>> # an unordered iterative and a blocking map, threads and serial >>> t.uimap(s.map, [f]*5, [range(i,i+5) for i in range(5)], [range(i,i+5) for i in range(5)]) <multiprocess.pool.IMapUnorderedIterator object at 0x103dcaf50> >>> list(_) [[0, 2, 4, 6, 8], [2, 4, 6, 8, 10], [4, 6, 8, 10, 12], [6, 8, 10, 12, 14], [8, 10, 12, 14, 16]] >>>
I found that in general, unordered iterative maps ( uimap ) are the fastest, but then you do not need to worry about which order is processed, since it can fail on return. As for speed ... surround above with a call to time.time or similar.
Get pathos here: https://github.com/uqfoundation