Reputation: 5805
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
Upvotes: 0
Views: 113
Reputation: 2349
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.
Upvotes: 3
Reputation: 2650
x86-64 should be faster than x86-32.
__fastcall
. The first four parameters you are passed to function is passed via register.Alway use 64-bits if you can.
Upvotes: 0
Reputation: 122381
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.
Upvotes: 3