Skip to content

Conversation

@Architector4
Copy link
Contributor

According to man gcc:

Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than -O0 for producing debuggable code because some compiler passes that collect debug information are disabled at -O0.

TLDR: it's a no-brainer to enable for debug builds. I'm running the game in debug nowadays, and using this genuinely just makes it run way faster lol

According to `man gcc`:

> Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than -O0 for producing debuggable code because some compiler passes that collect debug information are disabled at -O0.

TLDR: it's a no-brainer to enable for debug builds. I'm running the game in debug nowadays, and using this genuinely just makes it run way faster lol
@HeliumAnt
Copy link
Contributor

HeliumAnt commented Nov 13, 2025

Do not hardcode these in the build files, setup your build environment correctly instead using meson configure --debug or debugoptimized buildtype. Flatpak releases are also built with debug symbols

@HeliumAnt HeliumAnt closed this Nov 13, 2025
@Architector4
Copy link
Contributor Author

Huh. Never underestimate the complexity C++ codebase build systems I guess lmao

@Architector4
Copy link
Contributor Author

Oh wait, it gets even deeper: build type debug specifically adds -O0, killing optimizations, but build type debugoptimized specifically adds -O2, adding many optimizations, which in turn removes some debug info. To achieve the actually proper optimizations for debugging, one needs to use --optimization=g specifically.

why is meson like this lmao

@Architector4 Architector4 deleted the patch-7 branch November 13, 2025 22:11
@HeliumAnt
Copy link
Contributor

it's all very well documented. Using the build system to do these things means it's much more compatible between compilers. also though gcc says -Og is optimized for debugging, it doesn't actually work that well. in a lot of cases it still causes symbols to be missing or misplaced. -O2 mostly isn't even that much worse for debugging (so long as the symbols are generated)

@Architector4
Copy link
Contributor Author

Eh, fair. I guess I was just not expecting there to be a different debug build type in Meson, or this setting to not be that good apparently lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants