Optimize ZSTD_compress2() with ZSTD_c_stableOutBuffer and ZSTD_c_stableInBuffer
- 主要言語
- C
- スター
- 27.9k
- フォーク
- 2.6k
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 8
説明
* [x] Add `ZSTD_c_stableOutBuffer`, which tells the compressor that the output buffer will never change.
* [x] Add `ZSTD_c_stableInBuffer`, which tells the compressor that the input buffer will never change. This is subtle. You may think that `ZSTD_e_end` is enough. But that isn't a strong enough guarantee when streaming can't complete in one pass (because the output buffer is too small for example). Passing `ZSTD_e_end` just guarantees that you pass the same *unconsumed* bytes, it doesn't say anything about the bytes already consumed.
* [x] Use `ZSTD_c_stableInBuffer` to avoid allocating a window buffer.
* [x] Use `ZSTD_c_stableOutBuffer` to compress directly to the output buffer, even when not guaranteed to be large enough.
* [ ] Thread these optimizations through to zstdmt.
* [x] Set both parameters in `ZSTD_compress2()` (and reset them to their original values after).
With these two parameters set, the streaming API should be exactly as efficient as the single-pass API. Then we could consider using the streaming API to implement all other functions.
コントリビューションガイド
評価
この issue はまだ評価されていません。