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

@@ -14,6 +14,7 @@
#include <Nazara/OpenGLRenderer/Wrapper/WGL/WGLFunctions.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Win32/Win32Helper.hpp>
#include <Nazara/Platform/WindowHandle.hpp>
#include <NazaraUtils/StringHash.hpp>
#include <string>
#include <type_traits>
#include <unordered_set>
@@ -36,7 +37,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;
@@ -73,7 +74,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;
const WGLLoader& m_loader;
HDC m_deviceContext;
HGLRC m_handle;

View File

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