Skip to content

Conversation

yingcai-cy
Copy link
Contributor

No description provided.

Comment on lines 218 to 224
default_logger_ = std::static_pointer_cast<void>(logger);
log_func_ = [logger](LogLevel level, std::string_view format_str,
const std::string& formatted_message) {
if (logger->ShouldLog(level)) {
logger->LogImpl(level, "{}", formatted_message);
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately we still do a dynamic call, does it save us anything versus a virtual call? It is significantly more complicated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, function pointers are generally faster than virtual calls, and in some scenarios, the compiler is able to inline them, which can further improve performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants