abenci
abenci

Reputation: 8651

Using Int32 on a x64 machine

A part from memory usage, is there any benefit using an Int32 on a x64 machine if my values range from 0 to 2^32?

Thanks.

Upvotes: 0

Views: 181

Answers (2)

Angelom
Angelom

Reputation: 2531

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.

Upvotes: 0

flolo
flolo

Reputation: 15486

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.

Upvotes: 1

Related Questions