Closed hendesi closed 3 years ago
Are you building natively on ARM64? What ARM64 CPU are you using?
Ah, never mind, I see you're using docker buildx
.
docker buildx
runs your build under virtualisation using QEMU when you build for non-native architectures. As your machine is an Intel-based machine, this means you have to virtualise when building for AMD64. This is software virtualisation using Qemu, so sadly it's fairly slow. There isn't much we can do about that directly: this is a CPU-bound problem.
First of all, I want to say a huge thank you. This is a framework I've been using for a while now and its just awesome. You guys have been doing an amazing job!
To my problem: When building a simple swift package that has only swift-nio as a dependency on docker, the build times are highly different for ARM and AMD architectures. The docker step
RUN swift build -j 1 -c release -v
took around 300 seconds on AMD and on ARM It takes 2335 s, so almost 40 minutes just for building this package. This is a huge difference.Expected behavior
I'm not an expert on this, but I would expect the build times on arm and amd architectures to be somewhat similar.
Actual behavior
The actual build times for the different platforms differ significantly.
Steps to reproduce
cd SwiftNIODemoProject
docker buildx build --platform linux/arm64 -f DockerfileArm -t test-swiftnio-arm .
docker buildx build --platform linux/amd64 -f DockerfileAmd -t test-swiftnio-arm .
SwiftNIO version/commit hash
Swift & OS version (output of
swift --version && uname -a
)swift --version
Swift 5.5 Development Trunk Base for the AMD build is the official
swiftlang/swift:nightly-5.5-focal
image Since the official image is AMD only, the base image for ARM builds was created by this dockerfile using the official tar.uname -a
Darwin Felixs-MBP 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
Do you know there cause of this or if there are any flags that one can use to speed things up on ARM?