Match cache size between puffdiff and lz4diff am: ea4ca42744
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2850109
Change-Id: I8d50b88ed08d1c3f1301ca72bc882939db56951d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/lz4diff/lz4patch.cc b/lz4diff/lz4patch.cc
index 9de6d58..17fd8a2 100644
--- a/lz4diff/lz4patch.cc
+++ b/lz4diff/lz4patch.cc
@@ -172,10 +172,14 @@
bool puffpatch(std::string_view input_data,
std::string_view patch_data,
Blob* output) {
+ // Cache size has a big impact on speed of puffpatch, use a default of 5MB to
+ // match update_engine behavior.
+ static constexpr size_t kPuffPatchCacheSize = 5 * 1024 * 1024;
return puffin::PuffPatch(std::make_unique<StringViewStream>(input_data),
puffin::MemoryStream::CreateForWrite(output),
reinterpret_cast<const uint8_t*>(patch_data.data()),
- patch_data.size());
+ patch_data.size(),
+ kPuffPatchCacheSize);
}
std::vector<CompressedBlock> ToCompressedBlockVec(