-
Notifications
You must be signed in to change notification settings - Fork 38.7k
bench: Benchmark blockToJSON #16267
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: Benchmark blockToJSON #16267
Conversation
890fc96 to
1f034e1
Compare
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, some comments for your consideration.
src/bench/checkblock.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are usually together in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 seems to be a lot, on my system (2,9 GHz Intel Core i9):
time ./src/bench/bench_bitcoin -filter=SerializeJSONBlockTest
# Benchmark, evals, iterations, total, min, max, median
SerializeJSONBlockTest, 5, 10, 10.0509, 0.197745, 0.20436, 0.200661
./src/bench/bench_bitcoin -filter=SerializeJSONBlockTest 9.54s user 1.08s system 90% cpu 11.755 total
I think @MarcoFalke said that each should take around 4 seconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On i5-8250U 10 looks fine?
$ time ./src/bench/bench_bitcoin -filter=BlockToJsonVerbose
# Benchmark, evals, iterations, total, min, max, median
BlockToJsonVerbose, 5, 10, 5.64343, 0.104094, 0.118915, 0.112168
real 0m6.397s
user 0m6.183s
sys 0m0.202s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @MarcoFalke said that each should take around 4 seconds?
Yeah, they should take as much as all other tests take on average, which is 4 seconds on my machine. Though, this will vary based on what hardware you use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much I should set? I set 10 because it's give nearly 1s which based on this comment:
Line 137 in 332c613
| // Choose a num_iters_for_one_second that takes roughly 1 second. The goal is that all benchmarks should take approximately |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK cf75a25, needs squash though.
cf75a25 to
8c1650d
Compare
|
fixed unrelated changes and squashed |
|
ACK 8c1650d8b5014092cef511b3d56a49eda4c44424. |
|
Concept and |
8c1650d to
7766475
Compare
|
@fanatid had to push a new commit to fix windows build. Maybe wait until it's merged to rebase this one. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
@fanatid FYI base PR is now building. |
7766475 to
9859060
Compare
|
Rebased. |
9859060 to
91509ff
Compare
| static void BlockToJsonVerbose(benchmark::State& state) { | ||
| CDataStream stream(benchmark::data::block413567, SER_NETWORK, PROTOCOL_VERSION); | ||
| char a = '\0'; | ||
| stream.write(&a, 1); // Prevent compaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this comment more? Or move hacks into a one line function?
|
ACK 91509ff |
91509ff bench: Benchmark blockToJSON (Kirill Fomichev) Pull request description: Related: - "getblock performance issue on verbosity" #15925 - "refactor: Avoid UniValue copy constructor" #15974 ACKs for top commit: laanwj: ACK 91509ff Tree-SHA512: e70b12cb31921c7527bde334f52f39776da698b6bbdb196079a8b68478c67585a5bd7bed7403f65166bd604f7ed60778c53dc064d743bb8368318a1283d1073e
91509ff bench: Benchmark blockToJSON (Kirill Fomichev) Pull request description: Related: - "getblock performance issue on verbosity" bitcoin#15925 - "refactor: Avoid UniValue copy constructor" bitcoin#15974 ACKs for top commit: laanwj: ACK 91509ff Tree-SHA512: e70b12cb31921c7527bde334f52f39776da698b6bbdb196079a8b68478c67585a5bd7bed7403f65166bd604f7ed60778c53dc064d743bb8368318a1283d1073e
Summary: 91509ffe247b0eacbf84214c7c9c3f8a0012f2eb bench: Benchmark blockToJSON (Kirill Fomichev) Pull request description: Related: - "getblock performance issue on verbosity" bitcoin/bitcoin#15925 - "refactor: Avoid UniValue copy constructor" #15974 ACKs for top commit: laanwj: ACK 91509ffe247b0eacbf84214c7c9c3f8a0012f2eb Tree-SHA512: e70b12cb31921c7527bde334f52f39776da698b6bbdb196079a8b68478c67585a5bd7bed7403f65166bd604f7ed60778c53dc064d743bb8368318a1283d1073e Backport of Core [[bitcoin/bitcoin#16267 | PR16267]] Also cleans up the includes per Core [[bitcoin/bitcoin#16659 | PR16659]] Depends on D5980 Test Plan: ``` ninja check ninja src/bench/bitcoin-bench ./src/bench/bitcoin-bench -filter=BlockToJsonVerbose ``` Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5981
Related: