diff options
| author | 2019-04-02 13:52:50 +0100 | |
|---|---|---|
| committer | 2019-04-02 22:15:54 +0000 | |
| commit | 42d023445ae06a77777bce6fa99b457382d0f1a0 (patch) | |
| tree | 81c8346da6658154479c9dee3a479a8ac1170dc6 | |
| parent | 91038d67ce011456176411e8f74ed5d2e2440ed3 (diff) | |
Slightly increase XZ block-size.
Make slightly bigger random-access blocks to save space.
Bug: 110133331
Change-Id: I6192236b5094283854641d89be352d742fd2e936
| -rw-r--r-- | libelffile/elf/xz_utils.cc | 6 | ||||
| -rw-r--r-- | libelffile/elf/xz_utils.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libelffile/elf/xz_utils.cc b/libelffile/elf/xz_utils.cc index 0d47171258..87c9a7b758 100644 --- a/libelffile/elf/xz_utils.cc +++ b/libelffile/elf/xz_utils.cc @@ -32,7 +32,7 @@ namespace art { -constexpr size_t kChunkSize = kPageSize; +constexpr size_t kChunkSize = 16 * KB; static void XzInitCrc() { static std::once_flag crc_initialized; @@ -42,12 +42,12 @@ static void XzInitCrc() { }); } -void XzCompress(ArrayRef<const uint8_t> src, std::vector<uint8_t>* dst) { +void XzCompress(ArrayRef<const uint8_t> src, std::vector<uint8_t>* dst, int level) { // Configure the compression library. XzInitCrc(); CLzma2EncProps lzma2Props; Lzma2EncProps_Init(&lzma2Props); - lzma2Props.lzmaProps.level = 1; // Fast compression. + lzma2Props.lzmaProps.level = level; lzma2Props.lzmaProps.reduceSize = src.size(); // Size of data that will be compressed. lzma2Props.blockSize = kChunkSize; Lzma2EncProps_Normalize(&lzma2Props); diff --git a/libelffile/elf/xz_utils.h b/libelffile/elf/xz_utils.h index 2b11584ef0..df5cb56f2d 100644 --- a/libelffile/elf/xz_utils.h +++ b/libelffile/elf/xz_utils.h @@ -23,7 +23,7 @@ namespace art { -void XzCompress(ArrayRef<const uint8_t> src, std::vector<uint8_t>* dst); +void XzCompress(ArrayRef<const uint8_t> src, std::vector<uint8_t>* dst, int level = 1 /* speed */); void XzDecompress(ArrayRef<const uint8_t> src, std::vector<uint8_t>* dst); } // namespace art |