I'm uncompressing xz
files using lzma
module in python
with lzma.LZMAFile(compressed_path, "rb") as in_f, open(output_path, "wb") as out_f:
shutil.copyfileobj(in_f, out_f)
I'm trying to speed up multi-file uncompression in python, I've tried both:
concurrent.futures.ThreadPoolExecutor
(if it's IO-bound, multi-thread might help)concurrent.futures.ProcessPoolExecutor
(if it's CPU bound, multi-process might help, regarding GIL).
But they turn out to be almost the same.
My understanding for uncompression is that it's more likely IO-bound, at least the computation is much less than compression. But if it's really IO-bound, the speed is still much slower than simply copying files.
So what's really happening behind uncompress, and how should I improve the speed?