Skip to content

Commit d9a4252

Browse files
committed
Avoid quadratic performance wrt classpath length
1 parent 29c9cbc commit d9a4252

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/compiler/scala/tools/nsc/PipelineMain.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class PipelineMainClass(label: String, parallelism: Int, strategy: BuildStrategy
234234
println(f" Wall Clock: ${timer.durationMs}%.0f ms")
235235
case Pipeline =>
236236
projects.foreach { p =>
237-
val depsReady = Future.sequence(dependsOn.getOrElse(p, Nil).map(task => p.dependencyReadyFuture(task.t)))
237+
val depsReady = Future.sequence(dependsOn.getOrElse(p, Nil).iterator.map(task => p.dependencyReadyFuture(task.t)))
238238
val f = for {
239239
_ <- depsReady
240240
_ <- {
@@ -348,10 +348,10 @@ class PipelineMainClass(label: String, parallelism: Int, strategy: BuildStrategy
348348
private def expand(s: command.settings.PathSetting): List[Path] = {
349349
ClassPath.expandPath(s.value, expandStar = true).map(s => Paths.get(s).toAbsolutePath.normalize())
350350
}
351-
def classPath: Seq[Path] = expand(command.settings.classpath)
352-
def macroClassPath: Seq[Path] = expand(command.settings.YmacroClasspath)
353-
def macroClassPathSet: Set[Path] = macroClassPath.toSet
354-
def pluginClassPath: Set[Path] = {
351+
lazy val classPath: Seq[Path] = expand(command.settings.classpath)
352+
lazy val macroClassPath: Seq[Path] = expand(command.settings.YmacroClasspath)
353+
lazy val macroClassPathSet: Set[Path] = macroClassPath.toSet
354+
lazy val pluginClassPath: Set[Path] = {
355355
def asPath(p: String) = ClassPath split p
356356

357357
val paths = command.settings.plugin.value filter (_ != "") flatMap (s => asPath(s) map (s => Paths.get(s)))

0 commit comments

Comments
 (0)