contract A {
uint8 a = 0;
}
costs 20150 + 2000 gas during creation.
as compared to
contract A {
uint a = 0; // or uint256
}
costing 5050 + 2000 gas during creation
It is odd that a variable that's taking less storage space is costing more gas. Why is that so?
uint256. Next question I wonder if it's then always make sense to just stick to uint256 and never smaller. – uzyn Apr 16 '16 at 14:53uint32inside astructinstead ofuint256and push it into an array it cost much less gas tho. – alper Feb 02 '17 at 10:03