So I learned very early in my Solidity reading that we should be smart about memory allocation, specifically regarding the proper usage of uint variables. This means properly assigning uint8, uint16, uint32, uint64, uint256 based on the size of the values, so that variables could fit into 32 byte groupings.
However, in every reputable contract I look at, I see none of these practices being employed. They're all using uint256 variables to assign very small values of 20 or 200 or 10000. These variables are constants, and will never be changed. So what is the point of using uint256 for such small values? Why not use uint8 and uint16 for them to save space?
I'd chalk this up to bad code, but I see it everywhere in the largest and most reputable ERC721 contracts. Is there something I'm missing?
uintX
.