New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot match decompression time with 7-zip #93
Comments
Hi!
To be sure, with
How much time difference do you measure? There isn't really much configuration possible with the decompression, in contrast to what is possible with compression.
I did some basic tests and got just about +100/200ms of execution time on average, which I think is due to the inevitable overhead introduced by bit7z's interface. Anyway, I will investigate this further! |
Both 7z.exe and 7-zip GUI. Specially on very large files. I am trying to decompress files that are several GB large. |
Use a bigger buffer for input file streams. Addresses issue #93
I did some profiling, and it seems that the poor performance is due to the underlying For completeness, here is a boxplot generated from the data I collected during the benchmark; each program's sample size consists of 100 runs. The plot clearly shows the difference in the three cases: I will further investigate the remaining ~200ms of difference, but I think that now it's a more acceptable overhead. I will also consider whether to provide users with some way to easily customize the buffer size. Please, let me know if the commit fixes your issue! |
Sorry for taking so long to get back at you, but we were trying to gather some data because different machine were giving different results. But we did found out that your fix did improve the overall extraction time, but it still doesn't match what 7z.exe and 7-zip GUI does. |
No problem! Thank you for the tests!
The differences you measured may be due to the cache size of the various CPUs, which may differ from the one of the stream buffer, and thus penalizing the performance, at least in some cases (e.g., when the cache is smaller than the buffer). But I'm not an expert on this topic.
I actually expect most of the time to be spent in the 7z.dll code! However, 7-zip also uses code provided by bit7z for actually reading from the files. And this is where I think it's the overhead. The results seem closer to the 7-zip ones, with an average difference of only ~100ms (by comparison, v4 overhead was ~200ms on average).
You're welcome! And thank you for the tests and information you shared! |
I did a further test: I made the output file stream also use a bigger buffer. I pushed a commit (d35b092) with the change. |
I'm also seeing decompression being really, really slow compared to 7z.exe. I'm using the same 7z.dll v22.01 for both. 7z.exe extracts the archive in approx. 1min 53sec, while bit7z 4.0.0RC takes more than 30 minutes for the same 420MB "solid" 7z file. On Windows there's no noticeable difference between reading the entire 420MB file into memory and passing it as a single std::vector<byte_t> and passing the filename and allowing bit7z to open the file. (This isn't entirely surprising because Windows buffers files automatically if you start reading 'a lot' from them) I've not found any major clues as of yet, CPU profiling just shows a lot of time being spent inside 7z.dll - as expected, of course. |
Hi!
That's strange! I thought to have reduced the gap with 7z.exe, but apparently, it wasn't sufficient. If possible and it doesn't contain any sensitive data, could you share or send me the archive file that gives you the issue? It would really help me in finding the root cause of the problem. |
Unfortunately I can't share the 7z file as it's a 3rd party sending me their proprietary data ;) 7zFM says:
I have since realised that it's not a fair comparison as I'm extracting files from the solid archive in the order they are required by the application, not the order they are within the archive. Nearly all the time is spent in the My next step is going to be to build 7z.dll to get PDBs to analyse stacks that go through the 7z.dll. I won't have time to do that for another couple of weeks. |
No worries, I asked just in case! :)
I did several benchmarks using a similar solid archive containing XML and PNG images (only 58 files, though, but I don't think this influences the conclusion); in each benchmark, the program was executed 100 times, extracting the archive to a SATA SSD, and after each time the output files were deleted. In the benchmarks, when extracting the whole archive using I think the difference between v3 and v4 is because v4 uses C++'s
I think the way you extract the files is probably the reason for the very low performance. The first three cases are the same as before, where I extracted the whole archive. So yeah, extracting a solid archive without following the natural order of the archive comes with the price of a significant performance loss, which isn't likely due to bit7z. |
I have question. I have trying to use this API across multiple platforms and although, I can match the compression time with 7-zip tool by messing around with
I cannot do the same with decompressing. I was wondering if there is something there that may be causing the the API is not really matching C:\Program Files\7-Zip time?
I know there is not much that I am giving you, but I tried to look around in the code line, and nothing pops out. I was just wondering if you have ever attempted to compare performance between 7-Zip decompression and bit7z decompression.
Any insight will be useful. Thanks
The text was updated successfully, but these errors were encountered: