rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
602 stars 110 forks source link

[Feature Request]: Compare with 7zr.exe #221

Closed zpjjimmie closed 2 weeks ago

zpjjimmie commented 2 weeks ago

Feature description

when I use 7zr.exe from https://7-zip.org/download.html to compress 1G files, the result is 2M archive, use 200M memory to compress in one thread, the command is: a -t7z -bsp1 -mmt=1 but in the same environment, bitz7 make 200M archieve, use 40M memory to compress in one thread, the compresslevel is Max, it make me confuse why have so much different, 2M -> 200M

Additional context

No response

Code of Conduct

rikyoz commented 2 weeks ago

Hi!

it make me confuse why have so much different, 2M -> 200M

What confuses me is not the 200M archive produced by bit7z, but the 2M archive produced by 7zr.exe. 1G -> 2M is a compression ratio of 512:1, which is a lot and sounds suspicious and unrealistic (at least to my knowledge). What kind of files are you compressing? If the files are public, can you point me to where I can download them so that I can try to replicate the problem?

My current guess is that these files contain a lot of duplicates, and 7zr.exe takes this into account when compressing, but bit7z does not. But I'm not sure, so I'll need more information to replicate the problem!

zpjjimmie commented 2 weeks ago

thank you for your reply, your guess is right, because I use filldisk to generate txt file. but when I use concrete files(which is private in company projetct), it also has some diffrent in big files. for example: there is 500M files contains 1600 files, the result is: bit7z -> 150M and 7zr.exe->100M. and there is 1G files contains 1400 files, the result is: bit7z->50M and 7zr.exe->40M

rikyoz commented 2 weeks ago

I see, that makes sense.

The most likely reason for the difference in archive size is that 7zr.exe and bit7z use some different default settings.

For example, 7zr.exe enables solid compression under certain conditions, while bit7z doesn't enable it unless the user specifies it. You can enable it by calling writer.setSolidMode(true)/compressor.setSolidMode(true). Solid compression can reduce the size of archives, especially if they contain redundant data.

zpjjimmie commented 2 weeks ago

thank you