开发者

Using Int32 on a x64 machine

开发者 https://www.devze.com 2023-02-20 14:38 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消