Skip to content

Commit 615dfd5

Browse files
committed
Use a Loop Condition Instead of a Filtered Collection
When the set of input files is large, materializing this collection can be expensive. Just use a loop condition.
1 parent 990ff22 commit 615dfd5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ModuleDependencyScanning.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ internal extension Driver {
6161
}
6262

6363
// Pass on the input files
64-
commandLine.append(contentsOf: inputFiles.map { .path($0.file)})
64+
commandLine.append(contentsOf: inputFiles.map { .path($0.file) })
6565
return (inputs, commandLine)
6666
}
6767

Sources/SwiftDriver/Jobs/EmitModuleJob.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ extension Driver {
5959

6060
commandLine.appendFlags("-frontend", "-emit-module", "-experimental-skip-non-inlinable-function-bodies-without-types")
6161

62-
let swiftInputFiles = inputFiles.filter { $0.type.isPartOfSwiftCompilation }
63-
6462
// Add the inputs.
65-
for input in swiftInputFiles {
63+
for input in self.inputFiles where input.type.isPartOfSwiftCompilation {
6664
commandLine.append(.path(input.file))
6765
inputs.append(input)
6866
}

0 commit comments

Comments
 (0)