0

Is it always the case that the 64-bit release built program is faster than the 32-bit?

Execution happens on 64-bit machine for both.

Thanks

user2381422
  • 5,645
  • 14
  • 42
  • 56
  • See [here](http://askubuntu.com/questions/7034/what-is-the-difference-between-32-bit-and-64-bit-and-which-should-i-choose) for a related discussion in the context of linux. – Mankarse Jul 09 '13 at 08:22

3 Answers3

3

It depends what the program is doing.

If it was a chess engine, for example, which used bitboard representation of piece placement and movement, then I would expect it to be much faster than the 32-bit version.

For other compute-intensive applications then it should be faster as well, given the additional registers available to x86-64 processors.

However this is not true for all programs, for example if the problem is memory intensive and that memory is read from the filesystem, then the 64-bit version may be slower due to I/O.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
3

In most cases, yes, it is. 64-bit program can enjoy more CPU registers, bigger address-space (which can probably speed-up memory allocations on the heap even if the program does not actually need more then 2GB) so it is easier to the heap management to deal with heap fragmentation.

But it may also be slower in some cases, mainly due to the fact that 64-bit binary is in general bigger and eats a bit of more memory then its 32-bit counterpart. Every pointer takes 8 bytes instead of 4. That may cause difference whether important data fit into a CPU cache or not. And if it is a data used in a tight computation loop, it can make the speed difference. However "normal" programs hardly every hit this problem.

mity
  • 2,299
  • 17
  • 20
  • A normal in-memory DOM representation, for example, is already bigger than its serialized counterpart due to the amount of pointers. A data structure such as this, that is dominated by pointer sizes, will be considerably worse and slower on a 64 bit system. (For an interesting take on this, see the work done on using 32 bit pointers in x86-64 execution mode, for example here: http://stackoverflow.com/questions/9233306/32-bit-pointers-with-the-x86-64-isa-why-not ) – Magnus Hoff Jul 09 '13 at 09:00
0

x86-64 should be faster than x86-32.

  • x86-64 has more registers.
  • Its can do 64-bits operations in a single instruction.
  • It used improved __fastcall. The first four parameters you are passed to function is passed via register.

Alway use 64-bits if you can.

UltimaWeapon
  • 2,343
  • 18
  • 19
  • What is confusing is that there is no swarm of posts here saying "Yes definitely 64 is always faster than 32" in this case, why is that so? – user2381422 Jul 09 '13 at 08:06
  • 1
    @user2381422 Because it's subjective. If you cite a single task then a concrete measurement can be made, however you cannot say that this will be the case for *every* task. – trojanfoe Jul 09 '13 at 08:10
  • -1 See the other answers for why the 64-bit release won't *always* be faster than the 32-bit. –  Jul 09 '13 at 08:32