Skip to content

Gate debug logging with static DEBUG_ENABLED flag#303

Merged
fglock merged 1 commit intomasterfrom
feature/gate-debug-logging
Mar 12, 2026
Merged

Gate debug logging with static DEBUG_ENABLED flag#303
fglock merged 1 commit intomasterfrom
feature/gate-debug-logging

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Mar 12, 2026

Summary

  • Add CompilerOptions.DEBUG_ENABLED static boolean flag
  • Set flag when --debug or -D CLI arguments are parsed
  • Gate all ~300 logDebug() calls with one-line if (CompilerOptions.DEBUG_ENABLED) checks

Performance Improvement

When debugging is disabled (the common case), this avoids:

  • Method call overhead for each logDebug() invocation
  • String concatenation for debug message arguments
  • The conditional check inside logDebug() method

The JIT compiler can now short-circuit these calls at the call site level.

Test Plan

  • Build succeeds (./gradlew build)
  • All tests pass (./gradlew test)
  • Verified no debug output without --debug flag
  • Verified debug output appears with --debug flag

Generated with Devin

Add CompilerOptions.DEBUG_ENABLED static boolean that is set when
--debug or -D flags are parsed. All logDebug() calls are now guarded
with a one-line if statement check for fast short-circuit evaluation
when debugging is disabled.

This improves performance by avoiding method call overhead and string
concatenation for debug messages when not in debug mode.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
@fglock fglock merged commit 6278033 into master Mar 12, 2026
2 checks passed
@fglock fglock deleted the feature/gate-debug-logging branch March 12, 2026 07:05
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.

1 participant