fuzz: Avoid extraneous copy of input data, using Span<>#20839
Merged
laanwj merged 1 commit intobitcoin:masterfrom Feb 5, 2021
Merged
fuzz: Avoid extraneous copy of input data, using Span<>#20839laanwj merged 1 commit intobitcoin:masterfrom
laanwj merged 1 commit intobitcoin:masterfrom
Conversation
Contributor
|
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. |
This was referenced Jan 3, 2021
Contributor
Nice! Can you share the benchmarks and/or details on how to reproduce? :) |
Member
|
Concept ACK , can be rebased and maybe opened for review now that #20464 is merged. |
7b98b96 to
faf7d74
Compare
Member
Author
|
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 |
Member
Author
Contributor
|
cr ACK faf7d74: patch looks correct :) |
Member
|
That chart is a work of art 😄 Code review ACK faf7d74 |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Feb 5, 2021
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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