Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-05-14 - Optimize outputDebug to skip expensive string construction
**Learning:** outputDebug always constructs a timestamped message even when debug logging is disabled. This involves calling `new Date().toISOString()` and string concatenation, which is wasteful in the hot path of logging.
**Action:** Add an early return in `outputDebug` using `shouldOutput('debug')` to skip work when not in verbose mode.
2 changes: 2 additions & 0 deletions packages/cli-kit/src/public/node/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ export function outputCompleted(content: OutputMessage, logger: Logger = console
*/
export function outputDebug(content: OutputMessage, logger: Logger = consoleWarn): void {
if (isUnitTest()) collectLog('debug', content)
if (!shouldOutput('debug')) return

const message = colors.gray(stringifyMessage(content))
outputWhereAppropriate('debug', logger, `${new Date().toISOString()}: ${message}`)
}
Expand Down
Loading