Recently I've learned that every computation cycle performs on machine words which on most contemporary processors and OS'es are either 32-bit or 64-bit. So what are the benefits of using the smaller bit-size values like Int16
, Int8
, Word8
? What are they exactly for? Is it storage reduction only?
I write a complex calculation program which consists of several modules but is interfaced by only a single function which returns a Word64
value, so the whole program results in Word64
value. I'm interested in the answer to this question because inside this program I found myself utilizing a lot of different Integral
types like Word16
and Word8
to represent small entities, and seeing that they quite often got converted with fromIntegral
got me thinking: was I making a mistake there and what was the exact benefit of those types which I not knowing about got blindly attracted by? Did it make sense at all to utilize other integral types and evetually convert them with fromIntegral
or maybe I should have just used Word64
everywhere?