What is generally better: 64-bit or 32-bit?

I was just asked this question and referred to Phoronix: Ubuntu 12.04 LTS: 32-bit vs. 64-bit Performance. Phoronix is this excellent web-site run by Michael Larabel.

Below is a chart from 2012. Not all charts look this astonishing!

OpenSSL performance


This was also true in 2006, see below compilation times.

Kernel compilation times

So the answer generally is 64-bit. There are of course some shortcomings, like possibly slightly larger binaries, or some binaries being slower, but in general 64-bit is the way to go, regardless of the memory size in your computer. If you want to address memory above 2 GB, then of course you have no real choice.

See also Agner Fog: Optimizing software in C++. Some key facts from Agner Fog’s excellent book: 64 bit systems have several advantages over 32 bit systems:

  1. The number of registers is doubled. This makes it possible to store intermediate data and local variables in registers rather than in memory.
  2. Function parameters are transferred in registers rather than on the stack. This makes function calls more efficient.
  3. The allocation and deallocation of big memory blocks is more efficient.
  4. The SSE2 instruction set is supported on all 64-bit CPUs and operating systems.
  5. The 64 bit instruction set supports self-relative addressing of data. This make positions independent code more efficient.

Added 11-Mar-2016: 64-bit can be more power efficient, see phoronix: Using 64-bit Linux Software To Reduce Power Consumption?

Advertisements

One thought on “What is generally better: 64-bit or 32-bit?

  1. Pingback: Operation Costs Measured in CPU Clock Cycles – Elmar Klausmeier's Weblog

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s