From 5e6b02f2d39744ce4f94106b9f7322c22a919326 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 16 Mar 2021 20:46:58 -0400 Subject: [PATCH] Cache APP_SETTINGS lookups These are essentially singletons --- include/settings/settings_manager.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index e3b81511f8..961a69e9a4 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -85,7 +85,10 @@ public: template AppSettings* GetAppSettings( bool aLoadNow = true ) { - AppSettings* ret = nullptr; + static AppSettings* ret = nullptr; + + if( ret ) + return ret; auto it = std::find_if( m_settings.begin(), m_settings.end(), []( const std::unique_ptr& aSettings )