Optimize out a lot of std::string construction and allocations (#415)

Update CommandLineParameters.hpp

Update CommandLineParametersTests.cpp

Update WebContext.hpp

xmake check-files -f

Fix MaterialPassRegistry
This commit is contained in:
Jérôme Leclercq
2023-12-30 14:50:57 +01:00
committed by GitHub
parent f7c9060364
commit 79ec135af7
57 changed files with 219 additions and 210 deletions

View File

@@ -12,6 +12,7 @@
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/Platform/WindowHandle.hpp>
#include <NazaraUtils/StringHash.hpp>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <string>
@@ -37,7 +38,7 @@ namespace Nz::GL
PresentModeFlags GetSupportedPresentModes() const override;
inline bool HasPlatformExtension(const std::string& str) const;
inline bool HasPlatformExtension(std::string_view str) const;
void SetPresentMode(PresentMode presentMode) override;
@@ -72,7 +73,7 @@ namespace Nz::GL
};
Fallback fallbacks; //< m_ omitted
std::unordered_set<std::string> m_supportedPlatformExtensions;
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_supportedPlatformExtensions;
EGLContext m_handle;
EGLint m_maxSwapInterval;
EGLint m_minSwapInterval;

View File

@@ -16,9 +16,9 @@ namespace Nz::GL
{
}
inline bool EGLContextBase::HasPlatformExtension(const std::string& str) const
inline bool EGLContextBase::HasPlatformExtension(std::string_view str) const
{
return m_supportedPlatformExtensions.find(str) != m_supportedPlatformExtensions.end();
return m_supportedPlatformExtensions.contains(str);
}
}