Question

Supposing that memory is not an issue does targeting a 64 bit OS make a C/C++ Windows console application run faster?

Update: Prompted by a few comments/answers the application involves statistical algorithms (e.g., linear algebra, random number draws etc).

Was it helpful?

Solution

Replying mostly to the edit, not the original question: I've ported one application that's heavy on statistics and (especially) linear algebra to run as 64-bit code. For that code, the effort was minimal, and we got about a 3:1 improvement in speed.

I suspect that the majority of the notion that there often won't be comes (usually indirectly) from companies who have code that won't be easy to port, and are doing their best to tell customers why it's a good idea to continue buying their program, even though it's still 32-bit code. Of the code I've ported (or just "recompiled" in most cases) none has come out any slower as 64-bit code, and most has come out at least a little faster.

OTHER TIPS

The answer is maybe. You have to measure.

Using a 64 bits target allows the use of more registers, which implies less accesses to memory, and thus faster execution.

On the other hand, using a 64 bits target forces all pointers and addresses to be 64 bits, enlarging the memory footprint, and slowing the execution.

The answer is a big Maybe.

Targeting a different platform will certainly have a performance impact on your application as you're making a substantial change to the application. It has different size semantics for types, operations and very different operating system to interact.

These factors and many others will certainly lead to a performance change in your application. Whether it is subtle, huge, better, worse, etc ... will be highly specific to the type of application you are writing. It's not possible to give a general answer here without more details.

Everything else being equal (which is unlikely) the extra data size of the 64bit (twice as much data to move around when dealing with pointers) would lead to expecting it to be slower.

But other factors (e.g. WOW overhead) could dominate things...

The only way would be to test your application on the hardware you are targeting.

If most of the execution time is spent doing math then you might get a benefit. In most cases this is not true. If you're doing monte carlo simulations of nuclear reactors or raytracing renders or something similar you're probably going to see a big benefit. My SWAG is "not much benefit"

Possibly slower - you have just effectively halved the size of the CPU cache

Of course Intel and AMD's engineers know this so the memory manager does a lot of work to reduce the impact of 64bit wide pointers and integers where only the low 32bits are used

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top