add compression levels

This commit is contained in:
2021-11-26 00:01:33 +01:00
parent 5fedc032a9
commit c0560f99a8
3 changed files with 184 additions and 33 deletions

View File

@@ -45,14 +45,34 @@ impl MatchFinder {
suffixes,
rev_suffixes,
lcp,
max_queue_size: 1000,
max_matches_per_length: 10,
patience: 1000,
max_length_diff: 4,
max_queue_size: 100,
max_matches_per_length: 5,
patience: 100,
max_length_diff: 2,
queue: BinaryHeap::new()
}
}
pub fn with_max_queue_size(mut self, v: usize) -> MatchFinder {
self.max_queue_size = v;
self
}
pub fn with_patience(mut self, v: usize) -> MatchFinder {
self.patience = v;
self
}
pub fn with_max_matches_per_length(mut self, v: usize) -> MatchFinder {
self.max_matches_per_length = v;
self
}
pub fn with_max_length_diff(mut self, v: usize) -> MatchFinder {
self.max_length_diff = v;
self
}
pub fn matches(&mut self, pos: usize) -> Matches {
let index = self.rev_suffixes[pos] as usize;
self.queue.clear();