-
Notifications
You must be signed in to change notification settings - Fork 38.6k
fuzz: Avoid extraneous copy of input data, using Span<> #20839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Nice! Can you share the benchmarks and/or details on how to reproduce? :) |
|
Concept ACK , can be rebased and maybe opened for review now that #20464 is merged. |
7b98b96 to
faf7d74
Compare
|
To reproduce: diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp
index 282a2cd8ca..7a1c7b00d6 100644
--- a/src/test/fuzz/string.cpp
+++ b/src/test/fuzz/string.cpp
@@ -33,6 +33,16 @@
#include <string>
#include <vector>
+FUZZ_TARGET(max_throughput)
+{
+ FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
+ assert(
+ // "Teach" libFuzzer to explore long sequences (needs -use_value_profile=1 -len_control=1 -max_len=2000000)
+ fuzzed_data_provider.remaining_bytes() < 500'000 ||
+ // Make it crash when done
+ fuzzed_data_provider.ConsumeBool());
+}
+
FUZZ_TARGET(string)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());Then run a bunch and plot all FUZZ=max_throughput ./src/test/fuzz/fuzz -use_value_profile=1 -len_control=1 -max_len=2000000 |
|
cr ACK faf7d74: patch looks correct :) |
|
That chart is a work of art 😄 Code review ACK faf7d74 |
… Span<> faf7d74 fuzz: Avoid extraneous copy of input data, using Span<> (MarcoFalke) Pull request description: Seeing speedup here in the fuzz framework part (non-fuzz-target part). Speedup is only visible for input data larger than 100kB. ACKs for top commit: practicalswift: cr ACK faf7d74: patch looks correct :) laanwj: Code review ACK faf7d74 Tree-SHA512: 41af7118846e0dfee237a6d5269a6c7cfbc775d7bd1cc2a85814cb60f6c2b37fe7fd35f1a788d4f08e6e0202c48b71054b67d2931160c445c79fc59e5347dadf

Seeing speedup here in the fuzz framework part (non-fuzz-target part). Speedup is only visible for input data larger than 100kB.