You should try to put the writer part into a separate thread, because the writer blocks until data is written. If you've 2 separate threads then read and write can run in parallel. Something like:
q =deque()
with zipfile.ZipFile(pathname) as Z: for name in Z.namelist(): q.append((name, Z.read(name)))
----
In the writer thread:
while bRun: if not q: time.sleep(0.01) continue name, data = q.popleft() with open(name, "wb") as O: O.write(data) O.flush()
At least on the incredibly ugly Windows this helps a lot. Especially on Windows it is necessary to have a pool of writer threads to get at least a speed which is comparable to Linux.
Comment
You should try to put the writer part into a separate thread, because the writer blocks until data is written.
If you've 2 separate threads then read and write can run in parallel.
Something like:
q =deque()
with zipfile.ZipFile(pathname) as Z:
for name in Z.namelist():
q.append((name, Z.read(name)))
----
In the writer thread:
while bRun:
if not q:
time.sleep(0.01)
continue
name, data = q.popleft()
with open(name, "wb") as O:
O.write(data)
O.flush()
At least on the incredibly ugly Windows this helps a lot. Especially on Windows it is necessary to have a pool of writer threads to get at least a speed which is comparable to Linux.