Quick answer: Godot 4 export builds slow because of print() calls left in code? Debug prints still execute in release - wrap in OS.is_debug_build or use #ifdef DEBUG.

Game runs at 60fps in editor. Same project exported as release runs at 22. Profile shows print() in inner loops.

Guard prints

if OS.is_debug_build():
    print("hot loop:", value)

Strip print in release. OS.is_debug_build() is constant-folded in optimized builds.

Or use a debug logger

Wrap in a Log.debug(x) autoload that no-ops in release. Centralizes the strip.

Audit before release

grep -r "print(" --include="*.gd"

Quick sweep across the project. A hot-loop print is usually obvious.

“Prints are formatted strings even when output is hidden. The cost is in the formatting, not the I/O.”

Add a CI lint that fails on unguarded print() outside of editor-only scripts. Stops the regression in code review.