dev-cli icon indicating copy to clipboard operation
dev-cli copied to clipboard

decrease build times for pack command

Open fivetanley opened this issue 4 years ago • 0 comments

We can reuse the tarball and append new files (node binaries in this case) instead of compressing/extracting multiple times. This prevents un-necessary copying of files in the built tarball.

We can also build all targets in parallel in the following way:

  • Download Node.js versions for targets in parallel instead of serially
  • Use workerpool to create gzip files in parallel
  • Run all xz compression with maximum available threads. xz has supported multicore computation since 5.2 (2014).
  • Like gzip, run all xz compression in parallel instead of waiting for each target to build.

Running this in the Heroku CLI produced identical tarballs in 65% amount of time (~111s seconds vs ~344 seconds before this change). It's likely even a bit faster since I was running it locally which has some boot-up time due to ts-node compiling typescript at runtime.

This file brings in the tar dependency. This dependency is maintained by the npm team and is also cross-platform. This gets us quite a bit closer to allow building OClif CLIs on windows!

fivetanley avatar Mar 15 '21 22:03 fivetanley