feat: DeltaScheme adjustable compression ratio threshold - #8461
Conversation
Extract the hard-coded minimum compression ratio gate for the Delta integer scheme into a named MIN_DELTA_RATIO constant and raise the default from 1.0 to 1.25, matching the existing DELTA_PENALTY and MIN_DELTA_LEN tunables. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Move the minimum penalized compression ratio from a module constant onto DeltaScheme as a field, configurable via DeltaScheme::new(min_ratio). DeltaScheme::default() / DeltaScheme::DEFAULT use DEFAULT_MIN_RATIO (1.25). The static scheme registry uses the const DEFAULT so it stays usable in const context. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
… impl Remove the DEFAULT_MIN_RATIO and DEFAULT associated consts; DeltaScheme's default ratio (1.25) now lives only in the Default impl. The static scheme registry constructs DeltaScheme::new(1.25) directly in const context. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[128] |
186.1 ns | 244.4 ns | -23.86% |
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
246.4 ns | 304.7 ns | -19.14% |
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[2048] |
369.4 ns | 427.8 ns | -13.64% |
| ⚡ | Simulation | take_map[(0.1, 0.5)] |
1,180.4 µs | 992.5 µs | +18.93% |
| ⚡ | Simulation | take_map[(0.1, 1.0)] |
1.9 ms | 1.7 ms | +15.02% |
| ⚡ | Simulation | encode_varbin[(1000, 2)] |
177.4 µs | 158.4 µs | +12% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/delta-threshold-configurable-77gyu7 (543a598) with develop (4b867a0)
Footnotes
-
10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Delta is a more expensive compression scheme to decompress, so using it for a small win in compression since is a bad idea.
Set the default to 1.25
Summary
This PR makes the
DeltaSchemeconfigurable by allowing users to specify a custom minimum penalized compression ratio threshold, rather than using a hardcoded value. This enables more flexible tuning of when Delta encoding is selected during compression.