-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Add microbenchmarks to profile more code paths. #8873
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
Conversation
be1bd69
to
4568486
Compare
Trying to compile this on OS X:
|
After removing
|
bench_bench_bitcoin_LDADD += $(LIBBITCOIN_WALLET) | ||
endif | ||
|
||
bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) | ||
bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) | ||
bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -Wl,--start-group |
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.
Do we use some circular dependencies? Or why adding linker --start-group?
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.
He probably added it because of a weird crypter link issue:
libbitcoin_wallet.a(libbitcoin_wallet_a-crypter.o): In function `CCrypter::Encrypt(std::vector<unsigned char, secure_allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) const':
/.../bitcoin/src/wallet/crypter.cpp:85: undefined reference to `AES256CBCEncrypt::AES256CBCEncrypt(unsigned char const*, unsigned char const*, bool)'
/.../bitcoin/src/wallet/crypter.cpp:86: undefined reference to `AES256CBCEncrypt::Encrypt(unsigned char const*, int, unsigned char*) const'
Rather we should structure the libraries sanely than resort to linker groups, though.
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.
Yes, that's the issue I saw. I did try briefly to rearrange the link order and add dup library listings to work around the apparently circular dependencies, but for some reason nothing I tried worked so I resorted to --start-group. I can try again to figure find a working link order that doesn't require the flag, though.
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.
At least one circular dependency exists between the wallet and server libs:
./src/libbitcoin_server.a:libbitcoin_server_a-main.o:000000000000c6c0 T CheckFinalTx(CTransaction const&, int)
./src/libbitcoin_wallet.a:libbitcoin_wallet_a-wallet.o: U CheckFinalTx(CTransaction const&, int)
./src/libbitcoin_server.a:libbitcoin_server_a-init.o: U RegisterWalletRPCCommands(CRPCTable&)
./src/libbitcoin_wallet.a:libbitcoin_wallet_a-rpcwallet.o:0000000000000370 T RegisterWalletRPCCommands(CRPCTable&)
But this problem only manifests if you remove ccoins_caching.cpp, mempool_eviction.cpp, verify_script.cpp from the sources list (which is what I had done during development).
Otherwise, adding the crypo lib after the wallet lib as Wladimir suggested seems to be sufficient to build, so I updated the PR with this change and removed start-group.
Awesome! Thanks for doing this. |
I can't easily look at the source code now. What exactly causes the
circular dependency?
|
I think the problem is not a circular dependency here, but that |
4568486
to
c9086ed
Compare
Compiling has been fixed on OS X.
|
// (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484) | ||
static void CCoinsCaching(benchmark::State& state) | ||
{ | ||
CBasicKeyStore keystore; |
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.
Please clang-format the new code.
Concept ACK |
The new benchmarks exercise script validation, CCoinsDBView caching, mempool eviction, and wallet coin selection code. All of the benchmarks added here are extremely simple and don't necessarily mirror common real world conditions or interesting performance edge cases. Details about how specific benchmarks can be improved are noted in comments. Github-Issue: bitcoin#7883
c9086ed
to
18dacf9
Compare
Applied clang-format to all the new files. |
18dacf9 Add microbenchmarks to profile more code paths. (Russell Yanofsky)
18dacf9 Add microbenchmarks to profile more code paths. (Russell Yanofsky)
…ple output b21244e Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade) Pull request description: This PR is just a documentation update for someone (or myself) that looks into finishing up #7883 in the future. Looked through #7883 and appears [ryanofsky's PR](#8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open). Tree-SHA512: d758efc659c75f2b3ceb376f5a466c4234354077e4671ac3eb901c082c4e519ce5ff592cea4742711050b4ce56a1b65ef69433dd74e7db3eb11a8567d517d9e2
…ple output b21244e0be Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade) Pull request description: This PR is just a documentation update for someone (or myself) that looks into finishing up #7883 in the future. Looked through #7883 and appears [ryanofsky's PR](bitcoin/bitcoin#8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open). Tree-SHA512: d758efc659c75f2b3ceb376f5a466c4234354077e4671ac3eb901c082c4e519ce5ff592cea4742711050b4ce56a1b65ef69433dd74e7db3eb11a8567d517d9e2
18dacf9 Add microbenchmarks to profile more code paths. (Russell Yanofsky)
18dacf9 Add microbenchmarks to profile more code paths. (Russell Yanofsky)
…ted sample output b21244e Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade) Pull request description: This PR is just a documentation update for someone (or myself) that looks into finishing up bitcoin#7883 in the future. Looked through bitcoin#7883 and appears [ryanofsky's PR](bitcoin#8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open). Tree-SHA512: d758efc659c75f2b3ceb376f5a466c4234354077e4671ac3eb901c082c4e519ce5ff592cea4742711050b4ce56a1b65ef69433dd74e7db3eb11a8567d517d9e2
…ted sample output b21244e Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade) Pull request description: This PR is just a documentation update for someone (or myself) that looks into finishing up bitcoin#7883 in the future. Looked through bitcoin#7883 and appears [ryanofsky's PR](bitcoin#8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open). Tree-SHA512: d758efc659c75f2b3ceb376f5a466c4234354077e4671ac3eb901c082c4e519ce5ff592cea4742711050b4ce56a1b65ef69433dd74e7db3eb11a8567d517d9e2
…sample output Summary: b21244e Updating benchmarkmarking.md with an updated sample output and help options (Jeff Rade) Pull request description: This PR is just a documentation update for someone (or myself) that looks into finishing up #7883 in the future. Looked through #7883 and appears [ryanofsky's PR](bitcoin/bitcoin#8873) setup the benchmarks, but there are `FIXME` comments to pull in data from `test/` to get a larger data set (assuming reason why 7883 is still open). --- Backport of Core [[bitcoin/bitcoin#12187 | PR12187]] Test Plan: read it Reviewers: #bitcoin_abc, PiRK Reviewed By: PiRK Differential Revision: https://reviews.bitcoinabc.org/D8205
The new benchmarks exercise script validation, CCoinsDBView caching,
mempool eviction, and wallet coin selection code.
All of the benchmarks added here are extremely simple and don't
necessarily mirror common real world conditions or interesting
performance edge cases. Details about how specific benchmarks can be
improved are noted in comments.
Github-Issue: #7883