Re-enable Optimizations for macOS Builds #45638
Labels
Code: Build
Issues regarding different builds and build environments
OS: macOS
Issues related to macOS / OSX operating system
The current macOS builds run extremely slowly even on relatively decent hardware: 2.2 GHz quad-core i7 with 8GB DDR3 RAM, dedicated graphics, and an SSD. Sleeping a night takes ~5 minutes of realtime and I walk away from my computer while it's happening. This isn't a fun way to play. I tried adding the "no fungaloids" mod and it didn't help.
I learned that the macOS builds have optimizations turned off (-O0) because the clang that came with XCode on older (<=10.11) versions had a bug and couldn't support std::function with any optimization turned on. Maybe at the time this was OK if the game had less features enabled by default or less complexity. 10.11 is now two years past end-of-life so I don't think it's reasonable to hamper contemporary macOS users with bad performance. We don't even know if anyone plays on 10.11.
I compiled the game for my system (10.13 fwiw) and it runs so much faster it's amazing. We should provide this experience for more macOS users.
The way this is handled in the Makefile used for the builds is a parameter OSX_MIN which is currently set to 10.7 (if using clang) or 10.5 (if using gcc). If OSX_MIN <= 10.11 then you get -O0. If OSX_MIN > 10.11 then you get -O3. Note that this is true for RELEASE=1 builds, I'm not talking about debug builds. I don't think OSX_MIN is used for anything else, so I think we should just remove all this logic from the Makefile.
Anyone running <=10.11 can still compile the game themselves and set -O0.
Relevant PRs:
#30714
#26564
The text was updated successfully, but these errors were encountered: