magiskboot: Lower the compression presets for XZ & LZMA

magiskboot: Lower the compression presets for XZ & LZMA

The compression routine always uses the maximum compression preset for all formats.
This is problematic with XZ and LZMA because they use far more memory than the other formats, while just providing a very marginal advantage in the resulting file size.
The compression preset was changed from 9 to 6, which is often the default value and provides more than enough compression.
Tested on Samsung Galaxy Fame (512MB RAM, perfect for this).
This commit is contained in:
Michael Jauregui
2026-08-23 21:46:25 +00:00
committed by John Wu
parent 7600d3664f
commit a19666d884
+2 -2
View File
@@ -222,13 +222,13 @@ pub fn get_encoder<'a, W: Write + 'a>(
) -> std::io::Result<Box<dyn WriteFinish<W> + 'a>> {
Ok(match format {
FileFormat::XZ => {
let mut opt = XzOptions::with_preset(9);
let mut opt = XzOptions::with_preset(6);
opt.set_check_sum_type(CheckType::Crc32);
Box::new(XzWriter::new(w, opt)?)
}
FileFormat::LZMA => Box::new(LzmaWriter::new_use_header(
w,
&LzmaOptions::with_preset(9),
&LzmaOptions::with_preset(6),
None,
)?),
FileFormat::BZIP2 => Box::new(BzEncoder::new(w, BzCompression::best())),