scriptpubkeyman fuzz target TopUp is slow #30476

issue maflcko openend this issue on July 18, 2024
  1. maflcko commented at 8:09 am on July 18, 2024: member

    Seems wasteful to spend time in TopUp while fuzzing, so my recommendation would be to limit TopUp iterations a bit.

    Context: https://cirrus-ci.com/task/6178647134961664?logs=ci#L4357

     0Run scriptpubkeyman with args ['/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz', '-runs=1', PosixPath('/ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/scriptpubkeyman')]INFO: Running with entropic power schedule (0xFF, 100).
     1INFO: Seed: 3840853548
     2INFO: Loaded 1 modules   (623498 inline 8-bit counters): 623498 [0x5572c2e0a518, 0x5572c2ea28a2), 
     3INFO: Loaded 1 PC tables (623498 PCs): 623498 [0x5572c2ea28a8,0x5572c3826148), 
     4INFO:     8841 files found in /ci_container_base/ci/scratch/qa-assets/fuzz_seed_corpus/scriptpubkeyman
     5INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 924704 bytes
     6INFO: seed corpus: files: 8841 min: 1b max: 924704b total: 49718183b rss: 173Mb
     7[#128](/bitcoin-bitcoin/128/)	pulse  cov: 12139 ft: 24855 corp: 125/930b exec/s: 25 rss: 191Mb
     8[#256](/bitcoin-bitcoin/256/)	pulse  cov: 15522 ft: 49362 corp: 251/2416b exec/s: 4 rss: 286Mb
     9[#512](/bitcoin-bitcoin/512/)	pulse  cov: 19356 ft: 64381 corp: 483/6374b exec/s: 3 rss: 448Mb
    10Slowest unit: 18 s:
    11artifact_prefix='./'; Test unit written to ./slow-unit-c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
    12Base64: dHIoJTI5LzMvKicpXCUprSlUVO3t/e3t7e3tra2t7e0=
    13[#1024](/bitcoin-bitcoin/1024/)	pulse  cov: 21215 ft: 88717 corp: 877/17Kb exec/s: 2 rss: 610Mb
    14[#2048](/bitcoin-bitcoin/2048/)	pulse  cov: 21835 ft: 104559 corp: 1467/57Kb exec/s: 2 rss: 653Mb
    15[#4096](/bitcoin-bitcoin/4096/)	pulse  cov: 23163 ft: 120057 corp: 2005/171Kb exec/s: 2 rss: 694Mb
    16[#8192](/bitcoin-bitcoin/8192/)	pulse  cov: 24591 ft: 135480 corp: 2490/1045Kb exec/s: 3 rss: 849Mb
    17[#8844](/bitcoin-bitcoin/8844/)	INITED cov: 24681 ft: 137958 corp: 2568/7024Kb exec/s: 3 rss: 1001Mb
    18[#8844](/bitcoin-bitcoin/8844/)	DONE   cov: 24681 ft: 137958 corp: 2568/7024Kb lim: 793168 exec/s: 3 rss: 1001Mb
    19Done 8844 runs in 2763 second(s)
    
    0$ FUZZ=scriptpubkeyman perf record -g --call-graph dwarf  ./src/test/fuzz/fuzz -runs=10 ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
    1$ hotspot  ./perf.data 
    

    Screenshot from 2024-07-18 10-08-21

  2. maflcko added the label Wallet on Jul 18, 2024
  3. maflcko added the label Tests on Jul 18, 2024
  4. brunoerg commented at 4:42 pm on July 19, 2024: contributor

    Instead of calling TopUp every time we call AddDescriptorKey, maybe it could be done just one time per iteration. I can see it.

    Also, there are other functions, GetNewDestination, MarkUnusedAddresses and AddWalletDescriptor that internally call TopUp().

  5. brunoerg commented at 3:58 pm on July 20, 2024: contributor

    Instead of calling TopUp every time we call AddDescriptorKey, maybe it could be done just one time per iteration. I can see it.

    Also, there are other functions, GetNewDestination, MarkUnusedAddresses and AddWalletDescriptor that internally call TopUp().

    Forget, reducing keypool size should be enough. Just opened #30494.

  6. fanquake closed this on Jul 22, 2024

  7. fanquake referenced this in commit 8754d055c6 on Jul 22, 2024

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: 2024-11-21 09:12 UTC

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