feat(response): add zstd compression for responses#4215
feat(response): add zstd compression for responses#4215dave-atx wants to merge 1 commit intominiflux:mainfrom
Conversation
|
zstd will eventually land in go's stdlib. I think we can wait, as we already have gzip and flate via the stdlib, and brotli via an external dependency (that I'd love to remove once we have zstd). I don't think it's worth adding an external dependency for zstd: we're not in a hurry to add zstd support, adding another external library for nice-to-have-but-not-that-significant gains isn't worth it in my opinion, and brotli is currently widely supported while zstd isn't. |
|
@jvoisin absolutely fair points. What do you think about replacing the brotli lib with this zstd lib now? zstd has support in all current major browsers now, so only users on older browsers would get downgraded to gzip in the near term. It's also trivial to add zstd support to the fetcher side once the library is in. |
|
Sounds like a good idea to me, as the brotli implementation "was translated from the reference implementation with c2go". Good point on the fallback to gzip. On the other hand, I think it would be preferable to keep Oh and also, @fguillot what do you think? |
3b13ec2 to
cb52f62
Compare
|
@jvoisin thank you for the feedback! Incorporated your suggestions. As it stands, this PR:
|
Add zstd compression for HTTP responses and zstd decompression for feed fetching using klauspost/compress. Remove brotli support. Build with noasm,nounsafe tags to force pure-Go mode for klauspost/compress.
I would prefer to wait for Also, this pull request removes |

Add zstd as the preferred HTTP response compression algorithm using
klauspost/compress. zstd is substantially faster than brotli with similar compression ratios.Since this introduces a new dependency, it also swaps out stdlib
compress/gzipandcompress/flatefor theklauspostdrop-in replacements for better performance.