Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste 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. |
|
Getting decent throughput when running on my laptop: $ FUZZ=scriptpubkeyman ./build_fuzz_nosan/bin/fuzz ../qa-assets/fuzz_corpora/scriptpubkeyman/
...
#3326974 REDUCE cov: 14175 ft: 84867 corp: 5289/37Mb lim: 998620 exec/s: 1319 rss: 262Mb L: 15776/882699 MS: 1 EraseBytes-
#3327186 REDUCE cov: 14175 ft: 84867 corp: 5289/37Mb lim: 998620 exec/s: 1319 rss: 262Mb L: 961/882699 MS: 2 ChangeBit-EraseBytes-
#3328687 REDUCE cov: 14175 ft: 84867 corp: 5289/37Mb lim: 998620 exec/s: 1319 rss: 262Mb L: 1249/882699 MS: 1 EraseBytes-
...How is your server configured? Do you see a big speedup after applying this patch? |
What are the specs? How did you build it? Building with |
|
I'm on a i9-14900 with 96 GB RAM. I was running with only fuzzer sanitizer. When Running with only |
Ah, got it. This is expected, because ASan instruments most memory accesses in instrumented code and tracks heap allocations, while UBSan adds runtime checks for selected undefined behaviors. So operations like GetScriptPubKeys(), ConsumeCoins(), and some string operations, such as GetDescriptorString() can become more expensive under these sanitizers. |
883cf5a to
32b717e
Compare
32b717e to
3964b48
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
3964b48 to
5aabf8b
Compare
5aabf8b to
40786bb
Compare
|
Rebased |
I get around 2000 exec/s on master (4c99ed1) and 40786bb with --preset=libfuzzer. I also fuzzed the scriptpubkeyman target for 10 minutes on both commits, and got a similar amount of runs: Intel(R) Xeon(R) CPU E3-1275 v6 @ 4.20GHz with 64GB RAM I thought maybe the latest changes to the harness since your comments changed performance: I checked out c6f225c and c6f225c^. Same performance with around 2000 exec/s: So not sure where the low exec/s on your machines are coming from. |
Oh, no. With the scriptpubkeyman corpus from qa-assets, I get about 200–300 exec/s on the same machine. Thanks, this clears up my confusion! Sorry for the noise |
40786bb to
08499b1
Compare
|
Rebased |
pablomartin4btc
left a comment
There was a problem hiding this comment.
Concept ACK
A real improvement — the early return bug fix and moving expensive ops (GetDescriptorString, GetNewDestination) out of the hot path are the right calls.
Left a comment inline on the assertion coverage (not blocking).
Avoid calling IsMine for every single spkm from GetScriptPubKeys(). Also, expands `MarkUnusedAddresses` which covers it. In a later commit, we introduce the assertion back in a better way.
This new parameter is used to control the max number of coins this function might create. It allows us to create less than 10'000 coins and then reduce the cost.
GetDescriptorString calls ToNormalizedString or ToPrivateString, both of which rebuild the full descriptor string. This is expensive.
08499b1 to
37c2304
Compare
Assert both directions of the invariant, using the `spks` set that is now computed only once: - every script from GetScriptPubKeys() is IsMine; - every IsMine script is in GetScriptPubKeys(). The latter is asserted before MarkUnusedAddresses(), which may TopUp() and add scripts that are not part of the already computed `spks` set.
37c2304 to
0b0df80
Compare
pablomartin4btc
left a comment
There was a problem hiding this comment.
ACK 0b0df80
Since my last review, only a rebase plus the last commit, which now asserts the full IsMine/GetScriptPubKeys invariant in both directions using the precomputed spks set, thanks for taking that! Also nice catch on asserting the inverse direction before MarkUnusedAddresses(), since it may TopUp().

The scriptpubkeyman harness is slow - I'm getting under 40 exec/s on my personal server. This PR solves the following issues that may be affecting the performance:
IsMinecallsConsumeCoinsalways create up to 10'000 coins which may cause slowness.GetNewDestinationcalls (see flamegraph below).GetDescriptorStringunconditionally. It looks like an inofensive function but this is extremely costly due to calls toToNormalizedString/ToPrivateStringfunctions that touch key operations.