Slow Operation Detection #
What: New performance monitoring that detects and logs slow filesystem and shell command operations.
How it works:
- All synchronous filesystem operations (20 in total) are now wrapped with timing instrumentation
- Shell command executions via
execSyncWithDefaultsare similarly monitored - Operations exceeding 5ms are logged to debug output with the operation name and duration
Details:
- Log format:
[SLOW OPERATION DETECTED] fs.readFileSync (12.3ms)or[SLOW OPERATION DETECTED] execSyncWithDefaults (156.7ms): git status... - Monitored fs operations include:
existsSync,statSync,readFileSync,writeFileSync,appendFileSync,copyFileSync,unlinkSync,renameSync,readdirSync,mkdirSync,rmdirSync,rmSync, and others - For shell commands, the first 100 characters of the command are included in the log
- Logs are written to debug output (controlled by
CLAUDE_CODE_DEBUG_LOGS_DIRenvironment variable) - Evidence:
XX()wrapper function at line 554, thresholdZl2 = 5at line 605, shell monitoring inMG()at line 16934