32 bit vs 64 bit
Apr 15, 2014 · Commentscode c++
When to use 64-bit?
If your application needs more than 2-4gb of data
- If your application intensively uses 64-bit arithmetic
- * 32-bit x86 compiled applications are restricted to x86 instruction set, even when run on on a 64-bit machine
- x64 supports 16 registers compared to just 8 in x86. If your code is computation intensive this may help a great deal
When to use 32-bit?
After reading so many great things about 32 bit, why would anybody still want to code against 32-bit? Simple reason - code compiled in 32-bit takes lesser memory. For example, a pointer in 64-bit machine is 8 bytes compared to 4 bytes with 32-bit. Now imagine how many pointers do you have going around in your code?
When to not use 64-bit?
Sometimes if your code is running on a machine that does not have too much of space then it is a never a great idea to use 64-bit compilation because the same task can probably be done much better using 32-bit version. L2 and L3 caches will be utilized a lot more in 64-bit code (and a lot earlier as well) compared to 32-bit; on such systems.
Summary
Always benchmark your code and ensure that the application actually needs more than 2-4Gb of space.