18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 05:02:45 +01:00

perf: the settings static back with MSVC's thread-safe initialisation check

Takes back 3be7f5e82. /Zc:threadSafeInit- on utilities/Globals.cpp drops the guard from every function-local
static compiled in that file, those of the inline and template functions of stdafx.h and the project's headers
included, and the linker may keep that file's copy of such a function for the whole program. The 1.4% it gave
in one run is inside the run-to-run noise, so a static put in a header later and used from two threads isn't
worth the risk. Globals.cpp is built with the precompiled header again.
This commit is contained in:
jerrrrycho
2026-12-01 16:57:52 +01:00
parent 4a7eab6e13
commit 5b77fed81f
-7
View File
@@ -483,13 +483,6 @@ set(SOURCES
set(DEFINITIONS)
set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl3.cpp")
set_source_files_properties("imgui/imgui_impl_opengl3.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
# the settings (Global, GetGlobalSettings()) are a function-local static read everywhere all the time: MSVC's check of its
# thread-safe initialisation reads the thread's epoch from the TLS on every call. it's made once, by the main thread, before
# any other thread starts, so the plain check of the static does; the only function-local static of the file. without the
# precompiled header, which is built with the default
if(MSVC)
set_source_files_properties("utilities/Globals.cpp" PROPERTIES COMPILE_OPTIONS "/Zc:threadSafeInit-" SKIP_PRECOMPILE_HEADERS TRUE)
endif()
if (WITH_CRASHPAD)
set(DEFINITIONS ${DEFINITIONS} "WITH_CRASHPAD")