Skip to content

Commit 9b43de9

Browse files
authored
Avoid recreating LibIndexStore for every indexstore file (#985)
1 parent 2d9b99a commit 9b43de9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Indexer/SourceFileCollector.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ public struct SourceFileCollector {
2626
public func collect() throws -> [SourceFile: [IndexUnit]] {
2727
let excludedTargets = excludedTestTargets.union(configuration.excludeTargets)
2828
let currentFilePath = FilePath.current
29+
let lib = try LibIndexStore.open()
2930

3031
return try JobPool(jobs: Array(indexStorePaths))
3132
.flatMap { indexStorePath in
3233
logger.debug("Reading \(indexStorePath)")
33-
let indexStore = try IndexStore.open(store: URL(fileURLWithPath: indexStorePath.string), lib: .open())
34+
let indexStore = try IndexStore.open(store: URL(fileURLWithPath: indexStorePath.string), lib: lib)
3435
let units = indexStore.units(includeSystem: false)
3536

3637
return try units.compactMap { unit -> (FilePath, IndexStore, IndexStoreUnit, String?)? in

0 commit comments

Comments
 (0)