Details
- Reviewers
phosek leonardchan
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/Support/Compression.h | ||
---|---|---|
25–31 | I worry that this setup (a namespace that defines an interface) looks like it's setup for some kind of compile-time substitution (eg: #define LLVM_COMPRESSION_TYPE zlib then doing things equivalent to compression::LLVM_COMPRESSION_TYPE::compress) which I think was discussed earlier in the patch series and something I think I pushed back on. Compression default would likely be configurable, and which compression options are compiled in (if zlib is compiled in/available, if zstd is compiled in/available) would be configurable, but the choice would/should still be at runtime for ease of rollout, integration with different tools that might only support zlib, etc. ie: if you want to abstract over compression algorithms this should be a runtime abstraction, not a build time one - and this code here looks a lot like it'd be built for build-time choice of compression algorithm, which I think is something we should not do. |
@dblaikie Yes, the end goal is to make it configurable and eventually refactor to make a shared "compression class" interface where we have zlib and zstd implementations.
However, this patch/patch before it is only pointed at adding an implementation of code to call zstd in the first place. Also @MaskRay has an draft patch that demonstrates how this current setup could still be used in a runtime way.
Note to make that intention clear we have dropped the usage of namespace aliases at the request of @phosek and others.
Edit:
TLDR:
a refactor of compression to use a class interface system is out of scope IMO for this patch
I worry that this setup (a namespace that defines an interface) looks like it's setup for some kind of compile-time substitution (eg: #define LLVM_COMPRESSION_TYPE zlib then doing things equivalent to compression::LLVM_COMPRESSION_TYPE::compress) which I think was discussed earlier in the patch series and something I think I pushed back on. Compression default would likely be configurable, and which compression options are compiled in (if zlib is compiled in/available, if zstd is compiled in/available) would be configurable, but the choice would/should still be at runtime for ease of rollout, integration with different tools that might only support zlib, etc.
ie: if you want to abstract over compression algorithms this should be a runtime abstraction, not a build time one - and this code here looks a lot like it'd be built for build-time choice of compression algorithm, which I think is something we should not do.