If you are sure that your app. will only run on 64bit then, is it even conceivable (potentially a good idea) to use long for everything in Java?
Bad idea, IMO
Even if there is a difference between using int
and long
on a 64-bit JVM (which I think is highly doubtful), it won't be significant enough over the entire application, including the libraries that you depend on to warrant using long
for everything.
And there are some potential problems:
- You will use more memory, at least for
long[]
versus int[]
.
- You will regret it if your assumption about never needing to run on a 32-bit platform turns out to be wrong.
(The reason I think there won't be a significant performance difference is that the issue, if there is one, will be fetching and storing non-aligned int-32s. But if that is so, the JVM designers are likely to ensure that int-32 fields are always aligned on 64-bit word addresses. JVMs typically do this already with int-8 and int-16 on 32bit architectures ... )