-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCons: Disable /EHsc
for MSVC, speeds up build significantly
#80516
Conversation
Interesting error on tests after this change:
|
7d1dedd
to
6bf6211
Compare
So Doctest needs exceptions for the REQUIRE (and I think FAIL) macros, i.e. macros which mark the test as failed and abort. It has an option to disable the use of exceptions but that basically downgrades those macros to CHECK level, which mark the test as failed but don't abort. We could look into whether we can get by with only CHECK level macros, but if so we can't test unrecoverable conditions. I haven't assessed what our current tests need. So for now I just re-define |
As seen in godotengine#80513, `/EHsc` seems responsible for extremely long build times for complex files such as `gdscript_vm.cpp` and `variant_call.cpp`, when combined with optimization flags. On my Windows setup, a clean rebuild of the engine with `scons p=windows` (thus defaulting to `optimize=speed-trace`, i.e. `/O2` on MSVC) went from 35 min down to 16 min with this patch. Incremental rebuilds that would lead to recompiling either `gdscript_vm.cpp` or `variant_call.cpp` will benefit even more. We were using `/EHsc` to solve warnings in thirdparty code, so instead we silence that warning specifically. For tests, doctest needs exceptions for the macros we currently use, so we keep `/EHsc` in this environment only. Fixes godotengine#80513.
6bf6211
to
15e8cce
Compare
Just randomly passing by Looked around and seems you can disable EH for doctest: 2 config possible: DOCTEST_CONFIG_NO_EXCEPTIONS EH is evil |
Indeed, but as I pointed out above, I believe this will break the tests by downgrading REQUIRE/FAIL asserts to the non terminating CHECKED level, so some tests might crash if they rely on aborting when a non recoverable error happens. Could still be worth doing but this will likely require changing a lot of tests. |
There's also the quasi-supported (and undocumented) Has there been any consideration towards disabling exception-handling for GCC/Clang as well, through |
I made #80612 as an alternative to fully disable exception handling. Reviews and tests welcome :) |
Superseded by #80612. |
As seen in #80513,
/EHsc
seems responsible for extremely long build times for complex files such asgdscript_vm.cpp
andvariant_call.cpp
, when combined with optimization flags.On my Windows setup, a clean rebuild of the engine with
scons p=windows
(thus defaulting tooptimize=speed-trace
, i.e./O2
on MSVC) went from 35 min down to 16 min with this patch. Incremental rebuilds that would lead to recompiling eithergdscript_vm.cpp
orvariant_call.cpp
will benefit even more.We were using
/EHsc
to solve warnings in thirdparty code, so instead we silence that warning specifically.Fixes #80513.
I could use help to properly assess the impact of removing
/EHsc
and ignoring theC4530
warning. I'm not super familiar with exception handling and stack unwinding. Relevant docs: https://learn.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-170Patching thirdparty libraries so they don't raise this warning is also an option. In theory, we don't want any exception handling in Godot.