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

Tips to speed up compilation #509

Closed
jiayihu opened this issue Jan 10, 2021 · 8 comments
Closed

Tips to speed up compilation #509

jiayihu opened this issue Jan 10, 2021 · 8 comments

Comments

@jiayihu
Copy link

jiayihu commented Jan 10, 2021

Is there anything that can be done to speed up the cross-compilation? A native compilation taking about 1min can easily become 20mins within Docker. I usually go playing a blitz 5min+3s chess game meanwhile 😄

I'm currently using Docker Desktop on MacOS and I have a 15" MBP 2018. I've allocated 6 CPUs, 4GB RAM and 1GB Swap to Docker.

@jiayihu
Copy link
Author

jiayihu commented Jan 10, 2021

I have tried to add cached and delegated as suggested in #355 and by reading docker/for-mac#77 but it didn't change a bit. A debug recompilation without any file changed takes 24s on MacOS, 3mins with cross.

I guess it's some issue CPU-bound with the virtualization which can't be improved much

@ChzenChzen
Copy link

@jiayihu the problem is IO on Mac

@Alexhuszagh
Copy link
Contributor

Cached and delegated are no longer supported on macOS Docker (see here). Unfortunately, IO on mac with Docker is quite slow, and this is likely the issue. Using remote docker on an SSH server might work better, which we recently added. Please note you'd have to use persistent data volumes to see any enhancement: otherwise it would be much slower.

We might need to limit the amount copied back, since you might just want the builds and not the incremental artifacts, etc.

@Alexhuszagh
Copy link
Contributor

Closed since we now have full remote Docker support, which includes options to only copy changed files when using persistent data volumes. This might in some cases be much faster than running Docker locally on macOS, and if not, there's very little we can do. We can't use Podman right now (see #756, #757), and lima/nerdctl is very much so in beta, so this is outside the scope of cross.

@abcd-ca
Copy link

abcd-ca commented Oct 31, 2022

@Alexhuszagh would you mind sharing a brief note about why the need for remote docker and what kind of computer would be suitable to get? I have a pretty fast M1 Mac, not clear why it’s slow. Is a remote Intel PC with Ubuntu on the same LAN what is being suggested as a build server? Oh, maybe you mean setting up a container on the mac and the container is considered the remote?

@Emilgardis
Copy link
Member

On the Mac M1 the docker images can be slow to run due to bad QEMU virtualization. using CROSS_REMOTE with the context being the local host would not solve the issue.

You might have better milage using an aarch64 native image (which we don't host right now, see #751 (comment) for an example)

@Alexhuszagh
Copy link
Contributor

We're hoping soon to deploy native ARM64 images soon, the major obstacle currently is requiring self-hosted runners. However, I'll be re-integrating some automated testing for the process.

@abcd-ca
Copy link

abcd-ca commented Oct 31, 2022

Happy to test, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants