A part from memory usage, is there any benefit using an Int32 on a x64 machine if my values ran开发者_JAVA百科ge from 0 to 2^32?
Thanks.
Size also improves performane, because you can fit twice as much data into your cache. Also if you rely on vector operations twice as much elements can be handled in the same time.
Allignment could be a problem on certain architectures when using smaller datatypes, but x64 should have no problem with it.
You may find that your compiler has more registers to play with when it allocates them, keeping values loaded in registers gets rid of the need to get them from memory/cache. Typically a 64bit register can be treated as 2 32bit registers.
精彩评论