Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerate the rust compilation #259

Closed
Kailai-Wang opened this issue Nov 28, 2021 · 4 comments · Fixed by #409
Closed

Accelerate the rust compilation #259

Kailai-Wang opened this issue Nov 28, 2021 · 4 comments · Fixed by #409
Assignees
Labels
I2-medium should be completed within 10 working days

Comments

@Kailai-Wang
Copy link
Collaborator

Currently it takes ~20min to do a round of rust compilation(e.g. cargo clippy or docker build), this could bring about long waiting time if the self-hosted github runner is severely occupied (image there're multiple ongoing PRs, the compilation will be repeated for all the merging to/from dev and syncing).

Maybe there're ways to accelerate the process:

Low prio.

@Kailai-Wang Kailai-Wang added I1-low should be completed within 20 working days F2-tests/benchmarks/ci labels Nov 28, 2021
@Kailai-Wang Kailai-Wang added I2-medium should be completed within 10 working days and removed I1-low should be completed within 20 working days labels Feb 27, 2022
@Kailai-Wang
Copy link
Collaborator Author

Elevate the priority because we are going to change the build profile later in #326 which will significantly increase the build time

@Kailai-Wang
Copy link
Collaborator Author

sccache looks promising when building the binary natively, see https://github.com/litentry/litentry-parachain/actions/runs/1991565305

It took ~7min to run the cargo runtime test. Without sccache it would take ~20min+.

The problem remains with the docker build: it takes ~1hr on a github runner, see #393
Caching with docker/build-push-action doesn't do much, mostly because the cargo build is an "atomic" command and cannot break into sub-layers.

Looking for some other options like

  • cargo-chef
  • transferring the target/ directory around
  • to build dependency first?

@Kailai-Wang
Copy link
Collaborator Author

Kailai-Wang commented Mar 16, 2022

Experiments with cargo-chef and buildx GHA cache on github-runner: it seems to work.

When running on a github-runner, I see a decrease from 80min to 30min with the docker layer cached, however, 30min is still longer than the self-hosted runner without cache.

Self-hosted runner seems to have problems with buildx GHA cache + cargo-chef, however it looks like more like a GHA issue, see here.

@Kailai-Wang
Copy link
Collaborator Author

Kailai-Wang commented Mar 17, 2022

cargo-chef + local buildx cache works on a self-hosted runner, see the comparison before and after: 25min vs 14min

The difference is not significant as on github-runner though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-medium should be completed within 10 working days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants