Is 32 bits really better than 64?

At OSNews.com there are a number of benchmarks that promote the theory that 32-bit binaries are faster than 64-bit binaries. They use a venerable 333MHz UltraSPARC 2i as a test platform. Their first example is RSA operations, using OpenSSL 0.9.7c.

To counter their claims, we have benchmarked the same RSA operations using GMP 4.1.2. Since we didn't have access to any 333MHz UltraSPARC 2i system, we used a 296MHz UltraSPARC 2 system instead. Since scaling results is a questionable business, we haven't tried to compensate the GMP figures for our slightly slower machines. The gray bars below are taken from OSNews.com's best results. The violet bars denote results for GMP using 32-bit binaries and the wine-red bars denote results for GMP using 64-bit binaries.

As you can see, GMP is much faster than OpenSSL. That's no news, and it's not the main point with these diagrams. The point is that the 64-bit binaries are much faster than the 32-bit binaries. This is expected for bignum operations, as we have wider basic arithmetic operations, and thus get more work done with each machine instruction.

Now, UltraSPARC is a particularly poor example for showing the superiority of 64-bit processors for this problem domain, since this processor has a uniquely poor instruction set for bignum operations.

If we instead would compare an Athlon XP and an Athlon 64, the latter would be almost 4 times faster. Why 4 times and not just 2 times? Because a 64x64=>128 bit integer multiplication actually performs 4 times more work than a 32x32=>64 bit integer multiplication!

Niels Möller & Torbjörn Granlund
GMP developers


Please send comments about this page to webmaster@gmplib.org
Copyright 2004 Free Software Foundation
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.