-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
emscripten version: 3.1.2
Hi emscripten maintainers, thanks for the work on this incredible project. I am working on a C++ game for the web that I compile using emscripten. I recently ran into a use-case that required threading, so I began modifying my project to compile with thread support via the -pthread flag. These are the flags I used to compile with:
set(CMAKE_CXX_FLAGS "-O3 -s USE_WEBGL2=1 -s FULL_ES3=1 -s USE_GLFW=3 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -o index.html --preload-file ${project_resources} --use-preload-plugins -s ASSERTIONS=1")
This is what I switched to in order to enable thread support:
set(CMAKE_CXX_FLAGS "-O3 -s USE_WEBGL2=1 -s FULL_ES3=1 -s USE_GLFW=3 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -pthread -o index.html --preload-file ${project_resources} --use-preload-plugins -s ASSERTIONS=1")
This results in a build that runs perfectly fine in Firefox and Chrome, but for some reason in Safari 15.2 (the latest version) it leads to my rendering code taking over 20 seconds to put out a single frame. I don't have any threading code implemented yet - simply compiling the project with -pthread results in the enormous performance penalty.
Before I go and try to create a minimal reproducible build, does anybody have any ideas as to what might lead to this massive performance penalty? Is this a known issue in Safari? I have only found this issue from another person with a similar project that ran into this problem (link).
Thanks for your time.
Sample time it takes to render a frame with a -pthreads build (time obtained via glfwGetTime(), it's in seconds):
RENDERING START 225.98
RENDERING END 265.033