Reputation: 2753
What are the reasons behind the extension of small datatypes (e.g. byte) to int during the Numeric Promotion process? Wouldn't it be possible to perform most of the operations directly on these smaller datatypes?
Upvotes: 2
Views: 220
Reputation: 533500
The VM is a virtual machine, the JIT translates this to native code and optimises it then. All registers are either 32-bit or 64-bit and "shorter" operations are not necessarily and faster.
Upvotes: 2
Reputation: 16387
The VM does not support integers smaller than 4 octets, so when running in the VM you are operating on 4 octet ints or 8 octet longs. (Well it does for arrays, barray sarray, etc, just not for single values).
Upvotes: 0