-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-gitIssues or features related to using GitIssues or features related to using Gitneeds-verificationRequest for verificationRequest for verificationpending-releaseResolved but not yet released to the stable editionResolved but not yet released to the stable edition
Milestone
Description
Summary
Improves performance of ignored file checking by replacing shell-based git check-ignore execution with an in-memory cache, significantly reducing overhead when determining whether files are ignored by Git.
Impact
- Dramatically reduces overhead for ignored file checks (from process spawn to cache lookup)
- Improves responsiveness when working with large file sets
- Reduces CPU usage and eliminates repeated Git process spawns
- Benefits all features that check ignore status: file diffs, working directory changes, staging operations, etc.
Technical Details
Before: Each ignored file check spawned git check-ignore process via shell
After: In-memory cache with invalidation strategy
Implementation
- Cache stores gitignore patterns per repository
- Invalidates cache on
.gitignorefile changes - Falls back to Git command when cache miss or invalidated
- Handles nested gitignore files correctly
- Supports workspace-level
.git/info/excludepatterns
Validation
Functional Testing
- Open repository with complex
.gitignore(100+ patterns) - Create 50 new files (some matching ignore patterns, some not)
- Verify GitLens correctly identifies ignored vs. non-ignored files
- Modify
.gitignore→ verify cache invalidates and new patterns apply - Test nested
.gitignorefiles in subdirectories - Test
.git/info/excludepatterns
Performance Testing
- Benchmark time to check 1000 files for ignore status:
- Before: ~X seconds (shell spawn overhead)
- After: <100ms (cache lookup)
- Monitor CPU usage during large file operations
- Test with repository containing 100,000+ files
Edge Cases
- Empty
.gitignore→ verify cache works - No
.gitignorepresent → verify graceful handling .gitignorewith invalid syntax → verify error handling- Concurrent ignore checks → verify cache thread-safety
- Repository with multiple worktrees → verify cache per-worktree
Risk
Low — Performance optimization with clear fallback path. Potential concerns:
- Cache invalidation correctness (missing gitignore changes)
- Memory usage with large gitignore patterns
- Race conditions with concurrent file operations
- Behavior parity with
git check-ignore
Follow Ups
- Add metrics/telemetry to measure performance improvement
- Explore further optimizations (pattern compilation, bloom filters)
- Consider exposing cache statistics for debugging
- Investigate pre-warming cache on repository open
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-gitIssues or features related to using GitIssues or features related to using Gitneeds-verificationRequest for verificationRequest for verificationpending-releaseResolved but not yet released to the stable editionResolved but not yet released to the stable edition