What are the actual performance differences betwee

2019-06-22 05:31发布

问题:

What are the actual performance differences between Int64 and Int32 on 32 and 64 bit MS Windows?

It would also be great to see some actual timings of Int64 vs Int32 on each of the two operating system variants. XP or Vista would also be interesting.

  • See also this question about memcpy performance.

回答1:

As far as hardware, Int64 will be more efficient on an x64 and IA64 than x86 because the 64-Bit processors have 64-Bit registers to perform the operations on them.

Int32 will be equally as efficient on all x86, x64, and IA64.

On an x64 and on an IA64 both Int32 and Int64 are equally as efficient.

On an x86 Int32 will be more efficient than an Int64.

As far as the OS itself, I don't think you will see any extra performance issues than the performance results mentioned above.



回答2:

When in doubt, go with the int32. Not only is it faster on x86 architectures, and plenty of those are sitll around, but remember that your cache is finite, and you can fit twice as many int32 into your CPU cache as int64.



回答3:

You may wish to follow SpankyJ's past entries on 64-bit development

http://blogs.msdn.com/joshwil/archive/2005/04/28/413320.aspx



回答4:

From the hardware point of view, ie if the OS takes full advantage of the architechture, the Int64 will be more efficient on a 64 bit system.

Int32 may be slightly more efficient on a 32 bit system, since the 64 bit system may have to emulate the 32 bit operation.