Are 64-bit apps faster than 32-bit apps? (feat. Ubuntu for Raspberry Pi)
Ubuntu supports 64-bit Linux on the Raspberry Pi 4. Great, but are 64-bit programs and OSes faster than 32-bit programs and OSes? Is 64-bit more than just the 4GB memory limit? Let’s find out!
Thread test tool: https://github.com/garyexplains/examples/blob/master/threadtesttool.c
Segmented sieve of Eratosthenes: https://github.com/kimwalisch/primesieve/wiki/Segmented-sieve-of-Eratosthenes
——————–
PS. For those asking. I ran the segmented sieve test on an Intel/Linux box and compiled a 32-bit binary using (-m32) and also a 64-bit version. The 64-bit version was 30% faster.
PPS. Also I compiled and ran the segmented sieve on a 32-bit version of Raspbian running on the Pi 4, so a 32-bit binary on a 32-bit OS and it was actually slower than the 32-bit version running on the 64-bit OS. Total time for segmented_sieve 5000000000 was 28.8 seconds.
PPPS. For those saying it was different versions of the compiler that made the difference. I installed a 32-bit version of the GCC/G++ compiler (same version as the 64-bit) on Ubuntu 64-bit and compiled the 32-bit binary. The results were the same, in fact the 32-bit version compiled using the new compiler was slightly slower.
PPPPS. Yes I used the same compiler flags for everything
————————
Introduction to Android app development: https://www.dgitacademy.com
Let Me Explain T-shirt: https://teespring.com/gary-explains-let-me-explain-2
Twitter: https://twitter.com/garyexplains
Instagram: https://www.instagram.com/garyexplains/
#garyexplains
ubuntu