Skip to content

Commit 280a766

Browse files
committed
feat(fsst): remove min_count pre-filter in favor of gain-based selection
Replace the scaled min_count threshold (2-5 * sample_frac/128) with a simple zero-count filter. The gain-based priority queue already ranks candidates by value, making the pre-filter redundant. Removing it gives the priority queue a larger candidate pool, which helps datasets with diverse byte distributions (binary formats with many escape bytes). Improvements: arrow_ipc -5KB, stack_traces -15KB, dns_binary -2KB. No regressions on any of the 25 benchmark datasets. Signed-off-by: Claude <noreply@anthropic.com> https://claude.ai/code/session_01CbsKijtazMRRV6qsoM6e2G
1 parent 47a80d9 commit 280a766

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

encodings/fsst/src/fsst_rs/builder.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -864,16 +864,13 @@ impl CompressorBuilder {
864864
let symbol1_len = symbol1.len();
865865
let count = counters.count1(code1);
866866

867-
// From the c++ impl:
868-
// "improves both compression speed (less candidates), but also quality!!"
869-
// For longer symbols, we use a lower threshold since they're more valuable
870-
// per slot (each occurrence saves more bytes).
871-
let min_count = if symbol1_len >= 4 {
872-
2 * sample_frac / 128
873-
} else {
874-
5 * sample_frac / 128
875-
};
876-
if count < min_count {
867+
// Filter out zero-count symbols. We use a minimal threshold of 1
868+
// rather than the original C++ heuristic (which scaled min_count by
869+
// sample_frac) because the gain-based priority queue already ranks
870+
// candidates effectively. Allowing more candidates gives the gain
871+
// heuristic a larger pool to select the best 255 symbols from,
872+
// improving compression for datasets with diverse byte distributions.
873+
if count == 0 {
877874
continue;
878875
}
879876

0 commit comments

Comments
 (0)