I heard that using shorts on 32bit system is just more inefficient than using ints. Is this the same for ints on a 64bit system?
Python recently(?) basically merged ints with long and has basically a single datatype long, right? 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?
A Python
longhas arbitrary precision, it’s not 64-bit. Python 3 changedlongtoint, so now there is only one integral type of arbitrary precision, this saves a lot of work for the programmer. Java’s int is 32-bit, it’s long is 64-bit. A 64-bit processor can generally perform better than a 32-bit processor on a 64-bit integer.Using 32-bit integers on a 64-bit platform isn’t expensive, at least not in x64. It makes no sense to choose a 32-bit over 64-bit int or vise-versa in Java just for performance reasons. If you used two 32-bit ints instead of one 64-bit int, it would be slower no matter what. Similarily, if you use 64-bit where you could have used 32-bit, it will be slower on some platforms. In other words, use the right data type for your problem domain.