Skip to content

Commit 7648b41

Browse files
authored
Stronger WASM compression (#9875)
Use strongest compression 22 instead of just 3. See [docs](https://docs.rs/zstd/0.13.3/zstd/stream/write/struct.Encoder.html#method.new). Reduces our KAH compressed size by 25%. Build time by compression level: | Compression | Build Time | Size | Decomp Time | |-------------|-----------|---------|-------------| | 3 | 5:54 | 3192172 | 0.013039s | | 10 | 5:58 | 2716940 | 0.011962s | | 22 | 6:06 | 2387562 | 0.013745s | --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]>
1 parent bfa6642 commit 7648b41

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

prdoc/pr_9875.prdoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
title: Stronger WASM compression
2+
doc:
3+
- audience: Runtime Dev
4+
description: |-
5+
Use strongest compression 22 instead of just 3. See [docs](https://docs.rs/zstd/0.13.3/zstd/stream/write/struct.Encoder.html#method.new).
6+
Reduces our KAH compressed size by 25%.
7+
crates:
8+
- name: sp-maybe-compressed-blob
9+
bump: patch

substrate/primitives/maybe-compressed-blob/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn compress(blob: &[u8], bomb_limit: usize) -> Option<Vec<u8>> {
9191
let mut buf = ZSTD_PREFIX.to_vec();
9292

9393
{
94-
let mut v = zstd::Encoder::new(&mut buf, 3).ok()?.auto_finish();
94+
let mut v = zstd::Encoder::new(&mut buf, 22).ok()?.auto_finish();
9595
v.write_all(blob).ok()?;
9696
}
9797

0 commit comments

Comments
 (0)