Skip to content
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

Windows: Link MSVC dynamic debug CRT for debug builds #69294

Merged

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Nov 28, 2022

Fixes #31608.

Edit: See #69609, it's now opt-in behind the debug_crt=yes option.

Didn't test, please confirm if this works as expected.

See godotengine/godot-cpp#932 for a similar change in godot-cpp (CC @Faless).

And https://developercommunity.visualstudio.com/t/race-condition-on-g-tss-mutex-with-static-crt/672664 for a reference on the MSVC static CRT bug. Might be worth testing with newer MSVC to see if it's still broken.

@akien-mga akien-mga added this to the 4.0 milestone Nov 28, 2022
@akien-mga akien-mga requested a review from a team as a code owner November 28, 2022 12:00
@akien-mga akien-mga merged commit e82d66f into godotengine:master Dec 5, 2022
@akien-mga akien-mga deleted the windows-msvc-link-debug-runtime branch December 5, 2022 09:16
@YuriSizov
Copy link
Contributor

YuriSizov commented Dec 5, 2022

It seems this change has introduced a major regression in startup times (and perhaps performance?) for me. During the startup CPU gets to 100% utilization and it takes multiple times longer to get into any project, including an empty one.

I happen to use VS Code for C++ dev, and I have Godot Tools permanently enabled. With that startup times turn to a crawl. It takes a very long time to get to the splash screen, and then it is so slow to load beyond that I've been sitting for minutes to no avail. It will probably load, I can see activity in the logs, it's just sooo sooo slow. Seems like the language server is doing a lot of stuff on startup, which is multiplied by the regression from this change.

I use these flags to build Godot: platform=windows -j20 target=editor dev_build=yes. Switching to the previous commit in the master branch removes any slowdowns and removes 100% load on all cores for my 12/24 CPU.

akien-mga added a commit to akien-mga/godot that referenced this pull request Dec 5, 2022
Follow-up to godotengine#69294 which enabled it automatically for `dev_build=yes`,
but this seems to cause some issues.
Those issues should likely be debugged but until then this can stay opt-in.
@Zylann
Copy link
Contributor

Zylann commented Dec 5, 2022

I don't know if this is related, but if you compile in debug mode, Godot can decide to compile shaders and that can last for several minutes using 100% all cores. That does not happen twice though, unless the cache gets invalidated.
It might not be related to the CRT itself though: maybe it's because third-party libraries (such as shader compiler and the standard library) now pick up the _DEBUG flag properly and do debug checks and compile differently, which leads them to be slower.
I guess it was faster before because those libs did not compile with debug checks at all in dev builds...

rohanrhu pushed a commit to rohanrhu/godot that referenced this pull request Dec 28, 2022
Follow-up to godotengine#69294 which enabled it automatically for `dev_build=yes`,
but this seems to cause some issues.
Those issues should likely be debugged but until then this can stay opt-in.
rohanrhu pushed a commit to rohanrhu/godot that referenced this pull request Dec 28, 2022
Follow-up to godotengine#69294 which enabled it automatically for `dev_build=yes`,
but this seems to cause some issues.
Those issues should likely be debugged but until then this can stay opt-in.
Streq pushed a commit to Streq/godot that referenced this pull request Feb 9, 2023
Follow-up to godotengine#69294 which enabled it automatically for `dev_build=yes`,
but this seems to cause some issues.
Those issues should likely be debugged but until then this can stay opt-in.
@Ranoller Ranoller mentioned this pull request Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_DEBUG is not defined when compiling Godot in debug mode on Windows
3 participants