[Zlib-devel] Request for feature in zlib: Start and stop markers (patch attached)

John Reiser jreiser at bitwagon.com
Sat Jan 3 22:44:43 EST 2015


On 01/02/2015 01:35 AM, Ingvar Hagelund wrote:
    [snip]
> Varnish uses libvgz, which is zlib with a small patch. This patch gives
> access to start and stop markers in a stream of compressed files.
> Varnish uses this to sort out edge side includes when putting together
> http pages from backend servers for http clients.
    [snip]

A call to  deflate(strm, SYNC_FLUSH);  will align the stream to a byte boundary.
This works even for (0 == strm->avail_in), so such a call may be inserted after any
other call to deflate(), without modifying or interfering with any existing logic.
The space cost for aligning the stream is the cost for an empty [zero-length]
stored block: three bits, plus filler bits to the next byte boundary, plus
four bytes (00 00 ff ff); see the comments which follow the declaration of
deflate() in zlib.h.

Thus it seems to me that the varnish patch is equivalent to an optimization
to save about 5 bytes of space per marker in the output stream.
Is this savings valuable enough to make the patch worthwhile?





More information about the Zlib-devel mailing list