-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Replace the LogPrint function with a macro #17218
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
Is it known to be true that every call to LogPrint has no expressions with
side effects?
…On Tue, Oct 22, 2019, 11:28 AM Jeffrey Czyz ***@***.***> wrote:
Calling LogPrint with a category that is not enabled results in
evaluating the remaining function arguments, which may be arbitrarily
complex (and possibly expensive) expressions. Defining LogPrint as a
macro prevents this unnecessary expression evaluation.
This is a partial revert of #14209
<#14209>. The decision to revert
is discussed
in #16688 <#16688>, which adds
verbose logging for validation event notification.
------------------------------
You can view, comment on, or merge this pull request online at:
#17218
Commit Summary
- Replace the LogPrint function with a macro
File Changes
- *M* src/logging.h
<https://github.com/bitcoin/bitcoin/pull/17218/files#diff-0> (12)
Patch Links:
- https://github.com/bitcoin/bitcoin/pull/17218.patch
- https://github.com/bitcoin/bitcoin/pull/17218.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#17218?email_source=notifications&email_token=AAGYN67LZZ4C7NCSPBAFEVDQP5A4VA5CNFSM4JDTSZXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTSVB2A>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYN67C6XATDCTWFXGPE6TQP5A4VANCNFSM4JDTSZXA>
.
|
src/logging.h
Outdated
LogPrintf(args...); | ||
} | ||
} | ||
#define LogPrint(category, ...) do { \ |
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.
Just a suggestion, but it might be good to leave existing LogPrint function alone, and instead just add a new LOG_CATEGORY(category, format, ...)
macro. This would avoid issue the Jeremy raised about side effects in existing code, and also be nicer in my opinion because uppercase naming would be more consistent with other macros.
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.
My feeling is that providing two ways to log where one is subtly different than the other adds unnecessary cognitive load to readers and reviewers. Will address Jeremey's comment in a follow-up.
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.
My feeling is that providing two ways to log where one is subtly different than the other adds unnecessary cognitive load to readers and reviewers. Will address Jeremey's comment in a follow-up.
If the concern is cognitive load, I'd think the current:
LogPrintf
- log unconditionallyLogPrint
- log for category
is more confusing than what I'm proposing:
LogPrintf
- log unconditionallyLOG_CATEGORY
- log for category with macro magic
But if it would take a long time to deprecate LogPrint
(not sure why it would), then I agree inconsistency would not look nice in the interim.
I don't feel strongly any way about this, so please ignore this suggestion if doesn't suit you.
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.
Ah, I thought you were suggesting LogPrint
, LogPrintf
, and LOG_CATEGORY
.
I'm not completely opposed to changing call sites to LOG_CATEGORY
(and checking for side effects in the process). But I would like to be sure such a change would be welcome before putting in the work. :)
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 would like to be sure such a change would be welcome before putting in the work. :)
To be clear, suggestion is not to do more work. My suggestion is:
- Add your new macro with a name like
LOG_CATEGORY
, to be clear that it is a macro and not something that evaluated like a normal function. - Leave
LogPrint
alone, mark it deprecated and add a note like "LOG_CATEGORY is preferred over LogPrint in new code as a more performant alternative"
Separately after that, I do not think it would take a lot of work to replace instances of LogPrint
and remove it. We could start with a simple scripted-diff to replace simple variable references that obviously don't have side effects.
git grep -l LogPrint | xargs sed -i 's/LogPrint\((BCLog::[A-Z]\+, "[^"]\+"\(, [A-Za-z_]\+\)*)\)/LOG_CATEGORY\1/g'
As for organizing these changes, I might consider closing this PR, and instead adding the new macro directly where you intend to use it in #16688.
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.
Understood. I would be fine with that assuming there is agreement that LogPrint
should be deprecated in favor of the LOG_CATEGORY
macro.
Is this a pure optimisation PR, or can we think of reasons beyond that? Do we have any examples of slow Can we benchmark this in any way? |
Calling LogPrint with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining LogPrint as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification.
93e8f7a
to
8734c85
Compare
I've thought about it a bit and I think for the reason I gave above I'd
want to NACK this change.
If there are motivating examples for not evaluating the calls, they should
be fixed one by one.
It would also seem like perfect forwarding and inline can help with some of
these concerns too to nudge the compiler to defer constructing strings or
whatever.
…On Tue, Oct 22, 2019, 1:47 PM Jeffrey Czyz ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/logging.h
<#17218 (comment)>:
> @@ -155,12 +155,10 @@ static inline void LogPrintf(const char* fmt, const Args&... args)
}
}
-template <typename... Args>
-static inline void LogPrint(const BCLog::LogFlags& category, const Args&... args)
-{
- if (LogAcceptCategory((category))) {
- LogPrintf(args...);
- }
-}
+#define LogPrint(category, ...) do { \
Done in 8734c85
<8734c85>
.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17218?email_source=notifications&email_token=AAGYN6ZCEVD7RSKFT4WLQPTQP5RGBA5CNFSM4JDTSZXKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCI2YLLA#discussion_r337741803>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYN636IOUCRCYGJ2VKPFDQP5RGBANCNFSM4JDTSZXA>
.
|
I grepped over call sites to check if anything suspicious stood out, but I did not thoroughly check if each expression was free of side effects. Note that this PR simply reverts the unintended behavioral change of #14209. Any side effects would have been introduced by that PR or subsequent changes.
The motivating example is #16688. I think this change is relatively low risk and restores the previous behavior of
I don't believe perfect forwarding will prevent an argument expression from being evaluated, which is the reason for the PR. The compiler is also free to ignore |
I see it more as restoring the previous behavior of only paying for the logging that you want. Thus, anyone is free to add very verbose logging to their module without others incurring a cost when logging for that category isn't enabled. |
Ah didn't catch that it's reverting behavior.
I think that given that it's a revert it's more ok.
It's tricky to tell by glance if there are no side effects because of
atomics autoderef loading and stuff, which is why I felt it deserves
careful consideration.
I don't care to bikeshed too much, but I think that making it IF_CAT(cat,
expr) would be semantic in terms of implying the arguments may not be
evaluated, and then expr can be an unconditional Logprint. But that's a few
extra characters... I wouldn't object if expr is passed to LogPrint in the
macro, but feel it's a bit harder to comprehend at a glance.
…On Tue, Oct 22, 2019, 3:34 PM Jeffrey Czyz ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/logging.h
<#17218 (comment)>:
> @@ -155,12 +155,10 @@ static inline void LogPrintf(const char* fmt, const Args&... args)
}
}
-template <typename... Args>
-static inline void LogPrint(const BCLog::LogFlags& category, const Args&... args)
-{
- if (LogAcceptCategory((category))) {
- LogPrintf(args...);
- }
-}
+#define LogPrint(category, ...) do { \
Ah, I thought you were suggesting LogPrint, LogPrintf, and LOG_CATEGORY.
I'm not completely opposed to changing call sites to LOG_CATEGORY (and
checking for side effects in the process). But I would like to be sure such
a change would be welcome before putting in the work. :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17218?email_source=notifications&email_token=AAGYN67PZ3X5Z2MVSRXTJFDQP55W5A5CNFSM4JDTSZXKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCI3EIYQ#discussion_r337779900>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYN6Z3TFDBZLZOUXAEQITQP55W5ANCNFSM4JDTSZXA>
.
|
In other types of software that is universally a good idea, but it could be argued that in Bitcoin Core we want to make sure that execution of consensus critical code should be as identical as possible across clients. See sipas arguments in #4576 regarding always evaluating arguments to not have uncertainty what performance impact consistency checks. When it comes to consensus critical code it could be argued that consistency in taken code paths is often more important than raw execution speed. If we want to put that principle aside we should have good reasons for doing so: that's why it is important to benchmark a change like this. Is the performance impact measurable in practice? |
Never mind, I was confused here. It still uses an internal function for that. The whole point here was to be able to shortcut in case logging for the category was disabled… I think the assumption in #14209 was that an inline was just as good as a macro in this regard. Have you benchmarked this? |
Practicalswift asked the same question yesterday and this hasn't been benchmarked yet. It might be the case that performance is roughly equivalent, but if by "just as good" you mean actually equivalent, it's probably not a good assumption that compilers are going to be able to deduce that calls like |
|
Correct, I have not benchmarked the code. I'm not even sure how to adequately devise such a benchmark given the compiler can decide which call sites will have the code inlined. At very least, use of a macro will result in consistent behavior with regards to argument evaluation. |
Maybe we should look at the gnu::pure attribute (which have pretty wide support in gcc/clang/llvm and others, except MSVC) and noexcept, which would allow the compiler to better optimize such functions if this is an issue https://stackoverflow.com/questions/2798188/pure-const-function-attributes-in-different-compilers |
So, uh, no real direct input but at one point while reworking the logging for categories I changed the handling around and benchmarking as a function vs macro vs a few other things and found measurably slower validation (in particular early chain IBD which is already pretty fast), it was also easy to see it doing string parsing in the disassembly. There is another option beyond making this a macro: find the few performance critical logging spots and block them off with category tests (potentially just copying the current logging state into a local variable). This should be even faster than the macro, since you could eliminate many logging lines with potentially just one access to the contended global state. |
I think it's fine to do this. I strongly doubt there is any logging (especially categorized debug logging) with important side-effects. Not too long ago this was a macro. At least I've always treated it as one. If @MarcoFalke's concerns in #14209 no longer hold, ACK. |
Concept ACK. I think it's safer if this lives as a macro for the reasons described in the original post, and this especially shouldn't be controversial since (as others have noted) this was up until fairly recently a macro. |
My motivation for #14209 was to get code coverage test run, which was impossible prior to my fix. I don't care whether it is a function or macro. Someone should do a benchmark, though if the rationale for this change is "speed up". |
From what I understand it's not a benchmark issue but a conceptual one. Macros don't have the guarantee to evaluate their arguments, but functions (even inline functions) do. Given arguments that are expensive to compute (e.g. string formatting, allocation, conversions), that's will always make a difference in the disabled case. |
Our bench runner has a full testing setup, so in theory |
ACK 8734c85
Whether it is a function or macro seems completely orthogonal to this. The simple fix in #14209 would have just been to remove the ifdef preprocessor directive added here: c8914b9#diff-772f489c7d0a32de3badbfbcb5fd200dR133. The renaming Here are all the
None of the new logs with printf args have side-effects:
So merging this is at least as safe as we were prior to #14209. |
I ran the following benchmark configured with --enable-debug: #include <bench/bench.h>
#include <logging.h>
#include <validation.h>
static void BenchmarkLogPrint(benchmark::State& state)
{
LOCK(cs_main);
CBlockIndex* tip = ::ChainActive().Tip();
assert(tip != nullptr);
while (state.KeepRunning()) {
LogPrint(BCLog::NET, "%s: new block hash=%s", __func__, tip->GetBlockHash().ToString());
}
}
BENCHMARK(BenchmarkLogPrint, 10 * 1000 * 1000);
Looks like it's a couple of orders of magnitude faster as a macro. Let me know if there is something more representative to run. |
I believe we want |
re-run ci |
Oops. You're right. Same exercise for LogPrint:
|
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of #14209. The decision to revert is discussed in #16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
faf6e4b Use str.splitlines where appropriate (MarcoFalke) Pull request description: Before (only tested github-merge): ``` [pull/17218/local-merge e3ecb347e4] Merge #17218: Replace the LogPrint function with a macro Date: Fri Nov 1 10:08:05 2019 -0400 #17218 Replace the LogPrint function with a macro into master * 8734c856f85cb506fa97596383dd7e7b9edd7e03 Replace the LogPrint function with a macro (Jeffrey Czyz) (pull/17218/head) ACKs: * I've thought about it a bit and I think for the reason I gave above I'd want to NACK this change. If there are motivating examples for not evaluating the calls, they should be fixed one by one. It would also seem like perfect forwarding and inline can help with some of these concerns too to nudge the compiler to defer constructing strings or whatever. On Tue, Oct 22, 2019, 1:47 PM Jeffrey Czyz <notifications@github.com> wrote: > *@jkczyz* commented on this pull request. > ------------------------------ > > In src/logging.h > <bitcoin/bitcoin#17218 (comment)>: > > > @@ -155,12 +155,10 @@ static inline void LogPrintf(const char* fmt, const Args&... args) > } > } > > -template <typename... Args> > -static inline void LogPrint(const BCLog::LogFlags& category, const Args&... args) > -{ > - if (LogAcceptCategory((category))) { > - LogPrintf(args...); > - } > -} > +#define LogPrint(category, ...) do { \ > > Done in 8734c85 > <bitcoin/bitcoin@8734c85> > . > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <bitcoin/bitcoin#17218>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAGYN636IOUCRCYGJ2VKPFDQP5RGBANCNFSM4JDTSZXA> > . > (JeremyRubin) * ACK 8734c856f85cb506fa97596383dd7e7b9edd7e03 (jnewbery) Type 's' to sign off on the above merge, or 'x' to reject and exit. x ``` After: ``` [pull/17218/local-merge 74208557d0] Merge #17218: Replace the LogPrint function with a macro Date: Fri Nov 1 10:14:07 2019 -0400 #17218 Replace the LogPrint function with a macro into master * 8734c856f85cb506fa97596383dd7e7b9edd7e03 Replace the LogPrint function with a macro (Jeffrey Czyz) (pull/17218/head) ACKs: * ACK 8734c856f85cb506fa97596383dd7e7b9edd7e03 (jnewbery) Type 's' to sign off on the above merge, or 'x' to reject and exit. s ``` ACKs for top commit: laanwj: ACK faf6e4b Tree-SHA512: e573cce5b8ff382e05374d857258a5036eebbb1cc76ec130d663c9bd688bb556b9e4ebfeb6a0ea5e58c12494fb3c494c738db370136926adad976ceff0cfda8c
- rpc/wallet: initialize nFeeRequired to avoid using garbage value on failure bitcoin#18274 - httpserver: use own HTTP status codes bitcoin#18168 - tests: Add fuzzing harnesses for various Base{32,58,64} and hex related functions bitcoin#17229 - util: Don't allow Base32/64-decoding or ParseMoney(…) on strings with embedded NUL characters. Add tests. bitcoin#17753 - util: Fail to parse empty string in ParseMoney bitcoin#18225 - util: Fail to parse whitespace-only strings in ParseMoney(...) (instead of parsing as zero) bitcoin#18270 - Replace the LogPrint function with a macro bitcoin#17218 - Fix wallet unload race condition bitcoin#18338 - qt: Fix Window -> Minimize menu item bitcoin#18549 - windows: Enable heap terminate-on-corruption bitcoin#17916
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
…egular function 14f2239 [Util] Replace LogPrintf (but not LogPrint) macro with regular function (random-zebra) Pull request description: This commit combines together bitcoin#14209 [MarcoFalke] and bitcoin#17218 [jkczyz] - The first one replaces `LogPrintf` and `LogPrint` macros with functions: > It is not possible to run the full test suite when configured with --enable-lcov, since logging is disabled currently so that "unnecessary branches are not analyzed". (See c8914b9) > > Fix this instead by replacing the macros with functions. - The second one restores the `LogPrint` macro: > Calling LogPrint with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining LogPrint as a macro prevents this unnecessary expression evaluation. > > This is a partial revert of 14209. The decision to revert is discussed in 16688, which adds verbose logging for validation event notification. ACKs for top commit: furszy: ACK 14f2239 Fuzzbawls: ACK 14f2239 Tree-SHA512: bbbe475aae784e18acaf8f4f1eae8f6114f9ddb5eff460225fd0a1d40f999826bac99fb63f1359d71d03c6694d9c56fa697bfdee546188fe4fdf1a2f3de3eb22
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
8734c85 Replace the LogPrint function with a macro (Jeffrey Czyz) Pull request description: Calling `LogPrint` with a category that is not enabled results in evaluating the remaining function arguments, which may be arbitrarily complex (and possibly expensive) expressions. Defining `LogPrint` as a macro prevents this unnecessary expression evaluation. This is a partial revert of bitcoin#14209. The decision to revert is discussed in bitcoin#16688, which adds verbose logging for validation event notification. ACKs for top commit: jnewbery: ACK 8734c85 Tree-SHA512: 19e995eaef0ff008a9f8c1fd6f3882f1fbf6794dd7e2dcf5c68056be787eee198d2956037d4ffba2b01e7658b47eba276cd7132feede78832373b3304203961e
Calling
LogPrint
with a category that is not enabled results inevaluating the remaining function arguments, which may be arbitrarily
complex (and possibly expensive) expressions. Defining
LogPrint
as amacro prevents this unnecessary expression evaluation.
This is a partial revert of #14209. The decision to revert is discussed
in #16688, which adds verbose logging for validation event notification.