lueschem / edi-pi

Debian tool chain and image generation for Raspberry Pi 2, 3, 4 and 5.
https://www.get-edi.io
Other
48 stars 11 forks source link

Slow OS image build for arm64 image on amd64 host #34

Open lueschem opened 3 weeks ago

lueschem commented 3 weeks ago

Using Debian trixie the OS image build became pretty slow when executed on an amd64 host. Especially the Python interpreter startup was observed to be very slow:

On bookworm:

root@d6c3243fd469:/# time python3 -c "print('hello')"   
hello

real    0m0.343s
user    0m0.328s
sys 0m0.017s

On trixie:

root@cf115e77533a:/# time python3 -c "print('hello')"
hello

real    0m1.213s
user    0m1.203s
sys 0m0.012s

It looks like a significant speedup can be achieved by setting the QEMU_CPU environment variable:

buildah config --env QEMU_CPU=cortex-a57 edi-d35b0e3a-429715a5

The interpreter startup will now be more than 3 times faster:

root@cf115e77533a:/# time python3 -c "print('hello')"
hello

real    0m0.339s
user    0m0.330s
sys 0m0.012s
lueschem commented 3 weeks ago

The QEMU_CPU environment variable is "hidden" when Ansible is using the sudo command:

root@cf115e77533a:/# env | grep QEMU
QEMU_CPU=cortex-a57
root@cf115e77533a:/# sudo env | grep QEMU