Skip to content
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

[Feature Request]: When compressing in .7z format using solidMode, how to set solid block size like in 7zFM.exe? #241

Open
1 task done
yuzhengjun1204 opened this issue Sep 4, 2024 · 8 comments
Assignees

Comments

@yuzhengjun1204
Copy link

Feature description

When I use bit7z to compress in 7z format, the speed is half as fast as when I use 7-zip. I suspect this is because the solid mode is not set by default. I hope to achieve the same effect as 7-zip when using bit7z to compress in 7z format. Is there an example of a similar setting, translated into English?
image

Additional context

No response

Code of Conduct

@rikyoz
Copy link
Owner

rikyoz commented Sep 4, 2024

Hi!
The library doesn't provide a specific method to set the solid block size.
I'll likely add one in a next version.
In the meantime, you can use the setFormatProperty method to achieve the same result:

compressor.setSolidMode(true);
compressor.setFormatProperty(L"s", L"4g"); // Block size will be 4 GB.

Note that, to make it work, you still need to call the setSolidMode(true) method to enable solid compression.
The second parameter of the setFormatProperty must be a string value as in the namesake 7-Zip CLI parameter:

image

@yuzhengjun1204
Copy link
Author

Thank you very much for your reply!
When I use the following code to set the size to 4G, it prompts that there is not enough memory resources to complete the operation. But under the same parameters, 7-Zip can compress normally.

Bit7zLibrary lib{"7z.dll"};
BitFileCompressor compressor{lib, BitFormat::SevenZip};
std::vector<std::string> file_list;
file_list.push_back("D:\\test\\66");
compressor.setCompressionLevel(BitCompressionLevel::Normal);
compressor.setSolidMode(true);
compressor.setFormatProperty(L"s", L"4g");
//compressor.setOverwriteMode(OverwriteMode::Overwrite);
compressor.setDictionarySize(16 * 1024 * 1024);
compressor.setWordSize(32);
compressor.setThreadsCount(8);
compressor.setCompressionMethod(BitCompressionMethod::Lzma2);
compressor.compress(file_list, "d:\\test\\66.7z");

image

@yuzhengjun1204
Copy link
Author

I tried again, and the maximum I can set for the solid block size is 200m.

@rikyoz
Copy link
Owner

rikyoz commented Sep 5, 2024

Uhm this is really strange! What is the exact error message and error code (code()/hresultCode()) reported by bit7z?

I tried again, and the maximum I can set for the solid block size is 200m.

By any chance, did you monitor the RAM usage of the system and of the program using bit7z?

@yuzhengjun1204
Copy link
Author

hresultCode() =0x8007000E

By any chance, did you monitor the RAM usage of the system and of the program using bit7z?

I don't understand how to monitor the system here.

@rikyoz
Copy link
Owner

rikyoz commented Sep 6, 2024

Uhm strange. I did some tests but could not reproduce the issue.

hresultCode() =0x8007000E

Thanks.
This is the E_OUTOFMEMORY HRESULT error value. Really strange.

I don't understand how to monitor the system here.

I think just looking at the RAM usage in the task manager might reveal a potential problem with the program, for example if the RAM usage of the program ramps up without ever going down before crashing due to the out of memory error.
Other than that, I think profiling the program's heap allocation might also help.

@yuzhengjun1204
Copy link
Author

Thank you!
I rewrote the test program using Bit7z, and it performs the same as 7-zip. The previous issue was a strange one.
By the way, I would like to ask why bit7z doesn't set the solid compression mode by default when using the 7z format?

@rikyoz
Copy link
Owner

rikyoz commented Sep 10, 2024

Thank you!

You're welcome!

The previous issue was a strange one.

Strange indeed!

By the way, I would like to ask why bit7z doesn't set the solid compression mode by default when using the 7z format?

There's no particular reason.
When I added the support for enabling/disable the solid compression mode, I didn't think much about the default mode the library was supposed to have.
Ultimately, I agree: solid mode compression should be enabled by default, as it is in 7-Zip CLI.
But the problem right now is backward compatibility with previous versions of bit7z.
I'll probably change the default in a future version of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants