From 890f3fcf5d745b40203a28187c061727baff37a5 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 29 Jun 2024 22:13:21 +1000 Subject: [PATCH] Common/Log: Make actually writing unlikely Move it out of the hot path. --- src/common/log.h | 8 ++++---- src/core/memory_card.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/log.h b/src/common/log.h index 154f29103..128d6badf 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -72,26 +72,26 @@ void WriteFmtArgs(const char* channelName, const char* functionName, LOGLEVEL le ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, std::string_view message) { - if (level <= GetLogLevel()) + if (level <= GetLogLevel()) [[unlikely]] Write(channelName, level, message); } ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level, std::string_view message) { - if (level <= GetLogLevel()) + if (level <= GetLogLevel()) [[unlikely]] Write(channelName, functionName, level, message); } template ALWAYS_INLINE static void FastWrite(const char* channelName, LOGLEVEL level, fmt::format_string fmt, T&&... args) { - if (level <= GetLogLevel()) + if (level <= GetLogLevel()) [[unlikely]] WriteFmtArgs(channelName, level, fmt, fmt::make_format_args(args...)); } template ALWAYS_INLINE static void FastWrite(const char* channelName, const char* functionName, LOGLEVEL level, fmt::format_string fmt, T&&... args) { - if (level <= GetLogLevel()) + if (level <= GetLogLevel()) [[unlikely]] WriteFmtArgs(channelName, functionName, level, fmt, fmt::make_format_args(args...)); } } // namespace Log diff --git a/src/core/memory_card.cpp b/src/core/memory_card.cpp index 229aa5756..c99451e25 100644 --- a/src/core/memory_card.cpp +++ b/src/core/memory_card.cpp @@ -299,7 +299,7 @@ std::unique_ptr MemoryCard::Open(std::string_view filename) { std::unique_ptr mc = std::make_unique(); mc->m_filename = filename; - if (!mc->LoadFromFile()) + if (!mc->LoadFromFile()) [[unlikely]] { INFO_LOG("Memory card at '{}' could not be read, formatting.", mc->m_filename); Host::AddIconOSDMessage(fmt::format("memory_card_{}", filename), ICON_FA_SD_CARD,