aggresive pruning
This commit is contained in:
parent
2bc7872a51
commit
825d80b88d
@ -100,20 +100,26 @@ where
|
||||
// Experimental pruning
|
||||
#[cfg(any(feature = "sched_stg",feature = "sched_afl"))]
|
||||
{
|
||||
const PRUNE_THRESHOLD: usize = 200;
|
||||
if state.corpus().count() > PRUNE_THRESHOLD*vc {
|
||||
println!("Pruning corpus, keeping {} / {}", usize::max(1,vc)*PRUNE_THRESHOLD/2, state.corpus().count());
|
||||
const MULTI: usize = 10;
|
||||
const PRUNE_THRESHOLD: usize = 20;
|
||||
const PRUNE_MAX_KEEP: usize = 1000;
|
||||
const PRUNE_MIN_KEEP: usize = 100;
|
||||
let cc = state.corpus().count();
|
||||
let to_keep = usize::min(vc*MULTI, PRUNE_MIN_KEEP);
|
||||
let activate = cc > PRUNE_MAX_KEEP || cc > vc*PRUNE_THRESHOLD;
|
||||
if activate {
|
||||
println!("Pruning corpus, keeping {} / {}", to_keep, cc);
|
||||
let corpus = state.corpus_mut();
|
||||
let currid = corpus.current();
|
||||
let ids : Vec<_> = corpus.ids().filter_map(|x| {
|
||||
let tc = corpus.get(x).unwrap().borrow();
|
||||
let md = tc.metadata_map();
|
||||
if md.get::<IsFavoredMetadata>().is_some() || &Some(x) == currid || v.contains(&&x) {
|
||||
if vc < PRUNE_MAX_KEEP && (md.get::<IsFavoredMetadata>().is_some() || &Some(x) == currid || v.contains(&&x)) {
|
||||
None
|
||||
} else {
|
||||
Some((x, tc.exec_time().clone()))
|
||||
}
|
||||
}).sorted_by_key(|x| x.1).take(usize::saturating_sub(corpus.count(),usize::max(1,vc)*PRUNE_THRESHOLD/2)).sorted_by_key(|x| x.0).unique().rev().collect();
|
||||
}).sorted_by_key(|x| x.1).take(usize::saturating_sub(corpus.count(),to_keep)).sorted_by_key(|x| x.0).unique().rev().collect();
|
||||
for (cid, _) in ids {
|
||||
let c = state.corpus_mut().remove(cid).unwrap();
|
||||
fuzzer
|
||||
|
Loading…
x
Reference in New Issue
Block a user