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 #326

Closed
wants to merge 1 commit into from

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!

@fivetanley fivetanley force-pushed the decrease-pack-times branch 2 times, most recently from 8675638 to 018249b Compare March 15, 2021 18:07
- 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
@fivetanley
Copy link
Contributor Author

closing in favor of #330

@fivetanley fivetanley closed this Apr 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant