On 25/04/2026 9:00 AM, Meta wrote:
I'm not an expert in modern CPU architecture, but I'm extremely
skeptical of this claim. I doubt the difference is even noticeable with
modern compiler optimization techniques.
Its mostly 1 cycle these days, but 2 cycles for 64bit integer ops is
still in common use. However that only covers the big $$$ cpu's, who
knows about MCU's or cheaper processors.
* Promotion helps avoid accidental overflow which is more common with
small integer types.
I got 3 words for you: Value Range Propagation. We pay for it, so we
should use it wherever possible.
Yeah if you write code like the following, it'll use data flow analysis
to use the smaller bitwidth (tested):
```d
int calc(int arg) {
assert(arg <= 10);
long value = 1 + (arg * 3);
return cast(int)value;
}
```
After 30 years Walter's arguments surrounding 32bit int's is only now
starting to wane, give it another 30 and yeah then it should be gone.
But until then I'm listening to Walter as it has the widest applicability.