You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most places where IsLoggingEnabled() is used don't actually benefit from any performance benefit from conditional logging (e.g. they are logging a string literal which is trivially cheap anyway).
It could be that these are remnants from a previous implementation of Log() that fed the operands into a std::stringstream unconditionally. That is not the case today - operands are not formatted if logging is disabled.
We should still be careful to not evaluate operands that are expensive at the Log() call site, but even in this case, there might be cleaner ways of achieving the same outcome. For example, DescribeASIOTime() which is used as operand in some places could be improved to take the form of a class with an overloaded operator<<(), instead of returning a string, such that no actual string construction takes place until actual streaming.
The text was updated successfully, but these errors were encountered:
Most places where
IsLoggingEnabled()
is used don't actually benefit from any performance benefit from conditional logging (e.g. they are logging a string literal which is trivially cheap anyway).It could be that these are remnants from a previous implementation of
Log()
that fed the operands into astd::stringstream
unconditionally. That is not the case today - operands are not formatted if logging is disabled.We should still be careful to not evaluate operands that are expensive at the
Log()
call site, but even in this case, there might be cleaner ways of achieving the same outcome. For example,DescribeASIOTime()
which is used as operand in some places could be improved to take the form of a class with an overloadedoperator<<()
, instead of returning a string, such that no actual string construction takes place until actual streaming.The text was updated successfully, but these errors were encountered: