Skip to content

Commit

Permalink
Increase Compression Streams output buffer size
Browse files Browse the repository at this point in the history
Since zlib uses 256KiB of memory per compression stream with default settings, a
size of 16KiB will not increase memory usage by a large proportion. This should
make processing data slightly faster. Ideally we'd want this to be larger than
deflate's 32KiB window size which would allow zlib to avoid some extra copying
during decompression, but that can be done at a later time alongside other
compression optimizations.
  • Loading branch information
fhanau committed Jul 31, 2024
1 parent 90901c2 commit 68b4a98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/workerd/api/streams/compression.c++
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private:

Mode mode;
z_stream ctx = {};
kj::byte buffer[4096];
kj::byte buffer[16384];

// For the eponymous compatibility flag
ContextFlags strictCompression;
Expand Down

0 comments on commit 68b4a98

Please sign in to comment.