Buffer Size
The constructors for each of the compressed stream classes take a buffer size parameter. If not provided, the default size is 2048U. Data sent to the stream buffer is buffered in a block of the provided size until there is no room for additional data. Once the buffer is filled, it is compressed and forwarded along to the underlying stream buffer. A larger buffer tends to improve the compression ratio, but makes large blocks of contiguous memory unavailable to the rest of your application. A smaller value mitigates the memory problem, but the compression ratio suffers. This is something you need to adjust in the context of your application to decide on the value that produces the best performance.