Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

decrease build times for pack command #330

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

fivetanley
Copy link
Contributor

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!

- 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][1] to create gzip files in parallel
- Run all `xz` compression with maximum available threads. xz has
[supported multicore computation since 5.2 (2014)][1].
- 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.

[1]: https://www.npmjs.com/package/workerpool
[2]: https://www.phoronix.com/scan.php?page=news_item&px=MTg3MDM
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant