Releases: michaelversus/SwiftFindRefs
1.0.4
What's Changed
- Fix --derivedDataPath not working properly and renaming CLI option to --dataStorePath by @Nikoloutsos in #9
Full Changelog: 1.0.3...1.0.4
1.0.3
1.0.2
What's Changed
- Implement missing
swiftfindrefs --versionby @Nikoloutsos in #7
New Contributors
- @Nikoloutsos made their first contribution in #7
Full Changelog: 1.0.1...1.0.2
1.0.1
1.0.0
What's Changed
- feat: Introduce remove UnnecessaryTestable subcommand by @michaelversus in #5
Full Changelog: 0.2.5...1.0.0
0.2.5
0.2.4
Minor fixes
0.2.3
Adds an OpenSkills-compatible agent skill (swiftfindrefs/) to teach AI coding agents to use IndexStore-based reference discovery via swiftfindrefs instead of text search.
Thanks @ezefranca ❤️
0.2.2
Migrate to Swift Concurrency with Structured Concurrency
Overview
This MR migrates SwiftFindRefs from legacy GCD (DispatchQueue.concurrentPerform) to modern Swift Concurrency using structured concurrency (withTaskGroup). The migration improves code quality, type safety, and maintainability while maintaining equivalent performance.
🎯 Key Changes
Core Implementation
-
Replaced
DispatchQueue.concurrentPerformwithwithTaskGroup- Migrated from GCD-based parallel execution to Swift Concurrency task groups
- Eliminated manual thread synchronization code
-
Removed
ThreadSafeSetwithNSLock- Replaced manual locking mechanism with Swift's built-in structured concurrency
- Removed
@unchecked Sendableannotation and manual lock management - Reduced code complexity by ~15 lines
-
Made APIs async/await
IndexStoreFinder.fileReferences()methods are nowasync throwsCompositionRoot.run()is nowasync throws- Updated to
AsyncParsableCommandfor native async support
Test Updates
- Updated all test methods to use
async/awaitpatterns - Added
Sendableconformance to mock types for thread safety
📊 Performance
Benchmark Results
Test Configuration:
- Project: Large
- Symbol: Some (class)
- References Found: 136 files
Performance Comparison:
- Old (GCD): ~3.6-3.8 seconds, 134-169% CPU usage
- New (Swift Concurrency): ~3.3-4.6 seconds, 131-165% CPU usage
- Result: ✅ Equivalent performance with no regression
Key Metrics
- ✅ Correctness: Identical results (136 references)
- ✅ Performance: Equivalent execution times
- ✅ CPU Utilization: Effective multi-core usage (130-175%)
- ✅ Stability: Consistent performance across multiple runs
🔧 Technical Details
Before (GCD)
DispatchQueue.concurrentPerform(iterations: index.recordNames.count) { i in
let recordName = index.recordNames[i]
if recordContainsSymbol(store: store, recordName: recordName, query: query) {
let filename = index.sourcePath(for: recordName)
referencedFiles.insert(filename) // Manual lock required
}
}After (Swift Concurrency)
await withTaskGroup(of: String?.self) { group in
for recordName in index.recordNames {
group.addTask {
guard recordContainsSymbol(store: store, recordName: recordName, query: query) else {
return nil
}
return index.sourcePath(for: recordName)
}
}
// Automatic synchronization, no locks needed
}✨ Benefits
-
Structured Concurrency
- Automatic task management and cancellation
- Better error handling and propagation
- No manual synchronization required
-
Type Safety
- Compile-time guarantees with
Sendableconformance - Eliminated
@unchecked Sendableannotations - Better isolation checking
- Compile-time guarantees with
-
Code Quality
- Cleaner, more maintainable code
- Reduced complexity (~15 lines removed)
- Modern Swift 6.2 patterns
-
Future-Proof
- Ready for Swift 6 strict concurrency checking
- Aligned with Apple's recommended concurrency patterns
- Better integration with async/await ecosystem
🧪 Testing
- ✅ All 54 tests passing
- ✅ Benchmark verification completed
- ✅ Result correctness verified (identical output)
- ✅ Performance regression testing passed
🔍 Migration Strategy
This migration follows Swift Concurrency best practices:
- ✅ Replaced GCD with structured concurrency
- ✅ Removed manual synchronization primitives
- ✅ Added proper
Sendableconformance - ✅ Maintained backward compatibility (same results)
- ✅ Verified performance equivalence
📚 References
0.2.1
Architecture Improvements and Testability