Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 6, 2026

This PR attempts to address Issue #8131, specifically the question about CPU optimization for multi-worktree use cases.

Summary

Adds two new configurable settings for file watcher performance optimization:

  • codebaseIndexFileWatcherDebounceMs: Debounce delay for batching file changes (100-5000ms, default 500ms). Higher values batch more file changes together, reducing CPU spikes.
  • codebaseIndexFileWatcherConcurrency: Concurrency limit for file processing (1-20, default 10). Lower values process fewer files in parallel, reducing peak CPU usage.

These settings help reduce CPU usage when running multiple worktrees simultaneously by allowing users to:

  1. Increase debounce delays to batch more changes together
  2. Reduce concurrency limits to lower peak CPU usage

Changes

  • Add new constants and defaults in constants/index.ts
  • Add new fields to codebase-index types schema
  • Update CodeIndexConfigManager to load and expose the new settings
  • Update FileWatcher to use configurable debounce and concurrency values
  • Update service-factory to pass settings from config manager to file watcher
  • Add comprehensive tests for all new functionality

Testing

  • All existing tests pass
  • Added new tests for configurable performance settings in both config-manager.spec.ts and file-watcher.spec.ts
  • TypeScript type checking passes

Related Issue

Addresses #8131 - Per-workspace control for Codebase Indexing (reduce GPU)

Feedback and guidance are welcome!

…rktree optimization

Adds two new settings for file watcher performance optimization:
- codebaseIndexFileWatcherDebounceMs: Debounce delay for batching file changes (100-5000ms, default 500ms)
- codebaseIndexFileWatcherConcurrency: Concurrency limit for file processing (1-20, default 10)

These settings help reduce CPU usage when running multiple worktrees simultaneously
by allowing users to increase debounce delays and reduce concurrency limits.

Changes:
- Add new constants and defaults in constants/index.ts
- Add new fields to codebase-index types
- Update CodeIndexConfigManager to load and expose the new settings
- Update FileWatcher to use configurable values
- Update service-factory to pass settings to FileWatcher
- Add comprehensive tests for all new functionality
@roomote
Copy link
Contributor Author

roomote bot commented Jan 6, 2026

Rooviewer Clock   See task on Roo Cloud

Review completed. No issues were found in this PR.

The implementation is well-structured and follows existing codebase patterns:

  • Schema validation with proper min/max bounds
  • Constants properly centralized in packages/types
  • Config manager correctly loads settings with fallback to defaults
  • File watcher uses configurable debounce and concurrency values
  • Comprehensive test coverage for new functionality

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants