Skip to content

Parallelize terser minification in processTerserFullLink#59

Merged
Quafadas merged 2 commits into
mainfrom
copilot/parallelize-file-minification
Mar 30, 2026
Merged

Parallelize terser minification in processTerserFullLink#59
Quafadas merged 2 commits into
mainfrom
copilot/parallelize-file-minification

Conversation

Copilot AI commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Terser invocations in processTerserFullLink were sequential — each JS file was minified one at a time, leaving CPU and I/O capacity on the table for any project with more than one output chunk.

Changes

  • processTerserFullLink: Replace jsFiles.foreach with jsFiles.map { f => Future { ... } } + Await.result(Future.sequence(...), Duration.Inf) so all JS files are minified concurrently
  • Imports: Add scala.concurrent.{Await, Future} and scala.concurrent.duration.Duration; reuse the existing package-level implicit val ec from refresh_plugin.scala (no new dependency)
// Before
jsFiles.foreach { f =>
  os.proc("terser", ...).call(...)
}

// After
val futures = jsFiles.map { f =>
  Future { os.proc("terser", ...).call(...) }
}
Await.result(Future.sequence(futures), Duration.Inf)

Failure semantics are unchanged — if any terser process exits non-zero, the build fails.

Copilot AI linked an issue Mar 30, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Parallelize the file minification step in full link JS Parallelize terser minification in processTerserFullLink Mar 30, 2026
Copilot AI requested a review from Quafadas March 30, 2026 12:52
@Quafadas Quafadas marked this pull request as ready for review March 30, 2026 13:30
@Quafadas Quafadas merged commit c7017d8 into main Mar 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full Link JS

2 participants