fuzz: improve log performance#4523
Conversation
The searched-for log message ("Outbound update_fee HTLC buffer
overflow") no longer exists in the lightning crate, so the
from_utf8 + contains check on every log line was pure waste.
AI tools were used in preparing this commit.
Even though DevNull discards the bytes, the formatting work (SubstringFormatter, fmt::write, from_utf8) was still being done on every log call. Short-circuit in TestLogger::log via a TypeId check, which monomorphization resolves at compile time. AI tools were used in preparing this commit.
|
👋 I see @valentinewallace was un-assigned. |
|
No issues found. Details:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4523 +/- ##
==========================================
+ Coverage 86.14% 86.21% +0.06%
==========================================
Files 160 160
Lines 108046 108410 +364
Branches 108046 108410 +364
==========================================
+ Hits 93080 93461 +381
+ Misses 12346 12318 -28
- Partials 2620 2631 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TheBlueMatt
left a comment
There was a problem hiding this comment.
Hmm, we do want the ability to catch debug asserts in Display/Debug impls. Where is the perf improvement - is it focused on individual fuzzers?
For the fuzz CI job for chanmon consistency, it goes down from 10 to 4 minutes. There is just a lot being formatted, but then not actually logged. For catching asserts in display/debug, fuzzing seems not the most efficient way to do it. |
It turned out that null logging during fuzzing was still a break on performance because of unconditional format!'ing. 2.5x speed up in CI.