← Back to context

Comment by CodesInChaos

14 hours ago

Does git support better compression algorithms than deflate, like zstd or brotli?

No. You can configure the compression level but that's at far as it goes.

You can configure loose object and pack compression separately (core.compression and pack.compression) so loose object compression could be switched to an other algorithm as it's completely local[1] (likely a low-compression zstd), but pack files are part of the network exchange, so things are a bit more complicated there. Also an annoyance there is that git uses raw zlib there is no identifying header or anything.

There are old threads on the mailing list, as well as a gitlab issue.

Although you can also tune compression per pack when you create them explicitly, on $DAYJOB's repository in order to speed up gc some I have .keep packs which segregate images uncompressed in their own packs, because there's little point wasting cycles on zlib-compressing jpegs and pngs.

[1]: unless you're using the "dumb http" protocol, or performing (n)fs-mediated clones

  • I'm a bit surprised Github or some other big git hoster didn't push for such a protocol improvement. Since I assume that smaller and cheaper to create packs would reduce their costs noticeably.