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.

  • Operator declara... Dom Disc via Digitalmars-d-learn
    • Re: Operato... H. S. Teoh via Digitalmars-d-learn
    • Re: Operato... Dom Disc via Digitalmars-d-learn
    • Re: Operato... Meta via Digitalmars-d-learn
      • Re: Ope... Dom Disc via Digitalmars-d-learn
      • Re: Ope... Nick Treleaven via Digitalmars-d-learn
        • Re:... Meta via Digitalmars-d-learn
          • ... Dom Disc via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Nick Treleaven via Digitalmars-d-learn
            • ... Meta via Digitalmars-d-learn
              • ... Nick Treleaven via Digitalmars-d-learn
                • ... Dom Disc via Digitalmars-d-learn
                • ... Andy Valencia via Digitalmars-d-learn
                • ... Nick Treleaven via Digitalmars-d-learn
                • ... Dom Disc via Digitalmars-d-learn
                • ... Nick Treleaven via Digitalmars-d-learn
    • Re: Operato... Dom Disc via Digitalmars-d-learn
      • Re: Ope... Nick Treleaven via Digitalmars-d-learn

Reply via email to