From 28ce0e0f804de50f75eab797bc404c1be0b54442 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Mon, 17 Jun 2024 17:37:36 +0200 Subject: misc: a few compiler level performance optimisations (#6559) * window: use const references instead of copies use const references instead of wasteful copies and make the = operator check for self assignment and return early. also use const in all the other operators. * listener: pass std::function as const reference instead of copies pass the std::functions as const references. * config: dont unnecessarily convert to c_str getHyprlangConfigValuePtr wants an std::string and we already have an std::string, dont convert it to a c_str only for it to be converted back to an std::string. * buffer: pass attributes as const reference pass attributes as const reference instead of copies. --- src/config/ConfigValue.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/config/ConfigValue.hpp') diff --git a/src/config/ConfigValue.hpp b/src/config/ConfigValue.hpp index 72accd67..fc8abb4b 100644 --- a/src/config/ConfigValue.hpp +++ b/src/config/ConfigValue.hpp @@ -11,7 +11,7 @@ template class CConfigValue { public: CConfigValue(const std::string& val) { - const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val.c_str()); + const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val); p_ = PVHYPRLANG->getDataStaticPtr(); -- cgit v1.2.3