Speed of std::shared_mutex on MinGW unusually slow compared to MSVC and Clang under wsl.
Hello, I have a project which I did some profiling for recently, and noticed an unusual pattern: the cost of std::shared_mutex and specifically shared lock / unlock was unusually high (made entire runtime at least 5x slower) when compared to running the same code compiled with MSVC and clang under WSL. Any ideas on why this happens?
(the hyperlink points to the specific commit that I did profiling in.)
In recent commits I have done some work to require a lot less shared locks / unlocks, which has helped my total run time a lot, but some assistance in why this is happen and if there any solutions for it would be useful.
My use of std::shared_mutex is as follows: I have a global data state (see GState / g_ecs_data) which has some 'initialized on demand fields'. Anything that accesses these on demand fields is guarded by a std::shared_lock and anything that writes is guarded by a std::unique_lock.
( you can find the specific mutex in my repo with the keyword "archetypes_mtx" on the main branch (archetype_mtx on develop branch). while develop is where I do most of my work, main has all the necessary code for discussion)
for some actual numbers:
MinGW. 10-11 seconds for all threads to finish
MSVC: 700-800 ms for all threads to finish
Clang WSL: 900-100 ms for all threads to finish