You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-07 00:35:37 +02:00
Improve log performance, simplify macros, rename logWill() to logAny().
Pre-calculate the value used by logAny() to improve performance and make it more likely to be inlined. Move IF_LOG_ANY() into LOG_INTERNAL() to simplify the macros and improve performance of LOG() and LOG_PID(). If the message has no chance of being logged there's no reason to call logInternal(). Rename logWill() to logAny() because it seems more intuitive.
This commit is contained in:
@ -44,7 +44,7 @@ cmdBegin(bool logOption)
|
||||
ASSERT(cfgCommand() != cfgCmdNone);
|
||||
|
||||
// This is fairly expensive log message to generate so skip it if it won't be output
|
||||
if (logWill(cfgLogLevelDefault()))
|
||||
if (logAny(cfgLogLevelDefault()))
|
||||
{
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
@ -175,7 +175,7 @@ cmdEnd(int code, const String *errorMessage)
|
||||
ASSERT(cfgCommand() != cfgCmdNone);
|
||||
|
||||
// Skip this log message if it won't be output. It's not too expensive but since we skipped cmdBegin(), may as well.
|
||||
if (logWill(cfgLogLevelDefault()))
|
||||
if (logAny(cfgLogLevelDefault()))
|
||||
{
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
|
Reference in New Issue
Block a user