Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: Add --sanity-check flag, use it in make check #25107

Merged
merged 2 commits into from
May 17, 2022

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented May 11, 2022

The benchmarks are run as part of make check for a crash-sanity check. The actual results are being ignored. So only run them for one iteration.

This makes the bench_bitcoin part take 2m00 instead of 5m20 here. Which is still too long (imo), but this needs to be solved in the WalletLoading* benchmarks which take that long per iteration.

Also change all bench_bitcoin arguments to kebab-case to be consistent with the other tools (in a separate commit).

@laanwj laanwj added the Tests label May 11, 2022
@theStack
Copy link
Contributor

Concept ACK

src/bench/bench.cpp Outdated Show resolved Hide resolved
@w0xlt
Copy link
Contributor

w0xlt commented May 11, 2022

Concept ACK

@laanwj laanwj force-pushed the 2022-05-bench-one-iteration branch 2 times, most recently from c9de493 to 63068c7 Compare May 12, 2022 06:32
@fanquake
Copy link
Member

Concept ACK

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept and approach ACK, now building and testing.

src/bench/bench_bitcoin.cpp Outdated Show resolved Hide resolved
src/bench/bench.h Outdated Show resolved Hide resolved
@laanwj laanwj force-pushed the 2022-05-bench-one-iteration branch from 63068c7 to c52a71e Compare May 12, 2022 11:14
@laanwj
Copy link
Member Author

laanwj commented May 12, 2022

Re-pushed to address @jonatack's comments.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK c52a71e though the reduction in run time isn't large in my testing

OK
Running bench/bench_bitcoin (one iteration sanity check)...
bench/bench_bitcoin --one-iteration > /dev/null

Modulo typo in first commit message s/kebab-hase/kebab-case/

src/bench/bench.cpp Show resolved Hide resolved
@maflcko
Copy link
Member

maflcko commented May 13, 2022

Looks like #24924 might be related

@laanwj laanwj force-pushed the 2022-05-bench-one-iteration branch from c52a71e to 48b3828 Compare May 17, 2022 09:30
@laanwj
Copy link
Member Author

laanwj commented May 17, 2022

Re-pushed:

  • Argument is now -sanity-check.
  • Add warning that results are useless.
  • Fix typo in commit message.

Should be ready for final review round and merge.

@laanwj laanwj changed the title bench: Add --one-iteration flag, use it in make check bench: Add --sanity-check flag, use it in make check May 17, 2022
The benchmarks are run as part of `make check` for a minimum sanity
check. The actual results are being ignored. So only run them for one
iteration.

This makes the `bench_bitcoin` part take 2m00 instead of 5m20 here.
Which is still too long (imo), but this needs to be solved in the
`WalletLoading*` benchmarks which take that long per iteration.
This is customary for UNIX-style arguments, and more consistent with our
other tools
@laanwj laanwj force-pushed the 2022-05-bench-one-iteration branch from 48b3828 to 4f31c21 Compare May 17, 2022 09:32
@hebasto
Copy link
Member

hebasto commented May 17, 2022

Concept ACK.

@@ -57,6 +57,10 @@ void benchmark::BenchRunner::RunAll(const Args& args)
std::regex reFilter(args.regex_filter);
std::smatch baseMatch;

if (args.sanity_check) {
std::cout << "Running with --sanity check option, benchmark results will be useless." << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::cout << "Running with --sanity check option, benchmark results will be useless." << std::endl;
std::cout << "Running with -sanity-check option, benchmark results will be useless." << std::endl;

Also s/--sanity-check/-sanity-check/ in the commit message?

Copy link
Member

@jonatack jonatack May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure as there isn't a single-letter option like -s here, but per https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html: "Long options consist of -- followed by a name made of alphanumeric characters and dashes. Option names are typically one to three words long, with hyphens to separate words. Users can abbreviate the option names as long as the abbreviations are unique."

Edit: never mind, our convention is to use a single-hyphen prefix. That said, either way works for documentation purposes.

@echo "Running bench/bench_bitcoin ..."
$(BENCH_BINARY) > /dev/null
@echo "Running bench/bench_bitcoin (one iteration sanity check)..."
$(BENCH_BINARY) --sanity-check > /dev/null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$(BENCH_BINARY) --sanity-check > /dev/null
$(BENCH_BINARY) -sanity-check > /dev/null

@jonatack
Copy link
Member

jonatack commented May 17, 2022

ACK 4f31c21 on the sanity-check version per git diff c52a71e 4f31c28 (modulo s/--sanity check/--sanity-check/ in src/bench/bench.cpp::L61)

@laanwj
Copy link
Member Author

laanwj commented May 17, 2022

@hebasto Maybe I'm an old UNIX fart in some things but I prefer long options prefixed with two -, I prefer not to change this. And you can specify them with one - if you want, sure, that works too.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 4f31c21, tested on Ubuntu 22.04.

@fanquake fanquake merged commit dd8a2df into bitcoin:master May 17, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Oct 3, 2022
…k` in "Win64 native" task

91bee4d ci: Run `bench_bitcoin.exe --sanity-check` in "Win64 native" task (Hennadii Stepanov)

Pull request description:

  This PR adds [`--sanity-check`](bitcoin/bitcoin#25107) flag to `src\bench_bitcoin.exe` invocation as its results are been discarded.

  Also a better name used for the script as it follows GNU's `make check`.

ACKs for top commit:
  fanquake:
    ACK 91bee4d

Tree-SHA512: fd5feeda72d1ef46c5fbfc2aa5c042ab2e3de7772546379da4596306b5658ab95f62939fba237c0bd7a1b09c85de20fc1cd9e5df1efe11bdae50d4a7b8081f74
@bitcoin bitcoin locked and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants