fuzz: Avoid extraneous copy of input data, using Span<> #20839

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2101-fuzzSpan changing 4 files +10 −11
  1. MarcoFalke commented at 4:30 PM on January 3, 2021: member

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

  2. DrahtBot added the label GUI on Jan 3, 2021
  3. DrahtBot added the label RPC/REST/ZMQ on Jan 3, 2021
  4. DrahtBot added the label UTXO Db and Indexes on Jan 3, 2021
  5. DrahtBot added the label Wallet on Jan 3, 2021
  6. DrahtBot commented at 6:40 PM on January 3, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20663 (fuzz: Hide script_assets_test_minimizer by MarcoFalke)

    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.

  7. MarcoFalke removed the label GUI on Jan 3, 2021
  8. MarcoFalke removed the label RPC/REST/ZMQ on Jan 3, 2021
  9. MarcoFalke removed the label UTXO Db and Indexes on Jan 3, 2021
  10. MarcoFalke removed the label Wallet on Jan 3, 2021
  11. MarcoFalke added the label Tests on Jan 3, 2021
  12. practicalswift commented at 9:09 PM on January 12, 2021: contributor

    Seeing 5% speedup here in the fuzz framework part (non-fuzz-target part)

    Nice! Can you share the benchmarks and/or details on how to reproduce? :)

  13. laanwj commented at 2:18 PM on February 1, 2021: member

    Concept ACK , can be rebased and maybe opened for review now that #20464 is merged.

  14. fuzz: Avoid extraneous copy of input data, using Span<> faf7d7418c
  15. MarcoFalke force-pushed on Feb 3, 2021
  16. MarcoFalke marked this as ready for review on Feb 3, 2021
  17. MarcoFalke commented at 6:57 PM on February 3, 2021: member

    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 (lim, exec/s).

    FUZZ=max_throughput ./src/test/fuzz/fuzz -use_value_profile=1 -len_control=1 -max_len=2000000
    
  18. MarcoFalke commented at 7:20 PM on February 3, 2021: member

    My result (N=10, Firefox was running in the background, so take with a span of salt):

    out

  19. practicalswift commented at 9:07 PM on February 4, 2021: contributor

    cr ACK faf7d7418cf01cb04cd457bcc630654da958a777: patch looks correct :)

  20. laanwj commented at 1:56 PM on February 5, 2021: member

    That chart is a work of art :smile:

    Code review ACK faf7d7418cf01cb04cd457bcc630654da958a777

  21. laanwj merged this on Feb 5, 2021
  22. laanwj closed this on Feb 5, 2021

  23. MarcoFalke deleted the branch on Feb 5, 2021
  24. sidhujag referenced this in commit 8d5ae0a11e on Feb 5, 2021
  25. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me