Skip to content

Commit 07bb3cf

Browse files
authored
improve fetching of repositories from Pacakge.resolved (#3385)
motivation: improved performance changes: * refactor how parallelism is done when fetching the "pinned" containers, resulting in less thread hops
1 parent 5fe380c commit 07bb3cf

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Sources/Workspace/Workspace.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,19 +1794,15 @@ extension Workspace {
17941794
//
17951795
// We just request the packages here, repository manager will
17961796
// automatically manage the parallelism.
1797-
// FIXME: this should not block
1798-
let pins = pinsStore.pins.map({ $0 })
1799-
DispatchQueue.concurrentPerform(iterations: pins.count) { idx in
1800-
_ = try? temp_await {
1801-
containerProvider.getContainer(for: pins[idx].packageRef, skipUpdate: true, on: .sharedConcurrent, completion: $0)
1802-
}
1797+
for pin in pinsStore.pins {
1798+
containerProvider.getContainer(for: pin.packageRef, skipUpdate: true, on: .sharedConcurrent, completion: { _ in })
18031799
}
1804-
1800+
18051801
// Compute the pins that we need to actually clone.
18061802
//
18071803
// We require cloning if there is no checkout or if the checkout doesn't
18081804
// match with the pin.
1809-
let requiredPins = pins.filter({ pin in
1805+
let requiredPins = pinsStore.pins.filter{ pin in
18101806
guard let dependency = state.dependencies[forURL: pin.packageRef.location] else {
18111807
return true
18121808
}
@@ -1816,7 +1812,7 @@ extension Workspace {
18161812
case .edited, .local:
18171813
return true
18181814
}
1819-
})
1815+
}
18201816

18211817
// Clone the required pins.
18221818
for pin in requiredPins {

0 commit comments

Comments
 (0)