Skip to content

Commit

Permalink
bench: document expected results in logging benchmarks
Browse files Browse the repository at this point in the history
and clarify the intention behind the -nodebuglogfile bench.

Co-authored-by: "kouloumos <[email protected]>"
Co-authored-by: "Larry Ruane <[email protected]>"
  • Loading branch information
jonatack committed Mar 7, 2023
1 parent d8deba8 commit 20d89d6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bench/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include <logging.h>
#include <test/util/setup_common.h>

// All but 2 of the benchmarks should have roughly similar performance:
//
// LogPrintWithoutCategory should be ~3 orders of magnitude faster, as nothing is logged.
//
// LogWithoutWriteToFile should be ~2 orders of magnitude faster, as it avoids disk writes.

static void Logging(benchmark::Bench& bench, const std::vector<const char*>& extra_args, const std::function<void()>& log)
{
Expand Down Expand Up @@ -68,6 +73,7 @@ static void LogPrintfWithoutThreadNames(benchmark::Bench& bench)

static void LogWithoutWriteToFile(benchmark::Bench& bench)
{
// Disable writing the log to a file, as used for unit tests and fuzzing in `MakeNoLogFileContext`.
Logging(bench, {"-nodebuglogfile", "-debug=1"}, [] {
LogPrintf("%s\n", "test");
LogPrint(BCLog::NET, "%s\n", "test");
Expand Down

0 comments on commit 20d89d6

Please sign in to comment.