rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.54k stars 110 forks source link

opt-level = 3? #63

Open emk opened 7 years ago

emk commented 7 years ago

By adding the following to fuzz/Cargo.toml:

+[profile.dev]
+opt-level = 3

…I improve fuzzer throughput from:

#524288 pulse  cov: 3738 corp: 80/10238b exec/s: 1420 rss: 574Mb

...to:

#1048576    pulse  cov: 1584 corp: 79/10254b exec/s: 6808 rss: 594Mb

What would the tradeoffs be for including this in the default Cargo.toml, or at least documenting it?

emk commented 7 years ago

Also note that coverage numbers drop drastically, probably because of the elimination of basic blocks by the optimizer. But the corpus remains the same size.

whitequark commented 7 years ago

This may not necessarily be desirable because building unsafe code with opt-level = 0 is likely to leave more (most, though not all) dynamically reachable UB as it is. But it should be fine with safe code only; so a commented-by-default line with an explanation in Cargo.toml would be harmless and instructive.

whitequark commented 7 years ago

Or perhaps we could leave profiles alone and just mention the cargo fuzz run foo --release invocation in README. Though it ought to be obvious to anyone with even little Rust experience.

nagisa commented 7 years ago

IIRC this issue predates the --release flag.