News for hackers. Stuff that matters.
Re:Going Faster by Duplicating Code by ape4 on Tuesday October 10, 2023 @11:04PM (#37840419)
Honest question, would `V *= Factor` be faster?
Re:Going Faster by Duplicating Code by crote on Tuesday October 10, 2023 @11:39PM (#37840609)
In almost all cases: no.

"A compound assignment of the form E1 op= E2 differs from the simple assignment expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once." (C99, 6.5.16.2p3)

It only matters when evaluating E1 has side effects. For example, `a[i++] += 1;` which is equivalent to `a[i] = a[i] + 1; i++;` rather than `a[i++] = a[i++] + 1;`.

Re:Going Faster by Duplicating Code by vardump on Wednesday October 11, 2023 @02:19AM (#37841534)
> `a[i++] = a[i++] + 1;`

This is probably not what you want, as "i" is increased twice.

Re:Going Faster by Duplicating Code by jrumbut on Wednesday October 11, 2023 @02:41AM (#37841650)
That's why it matters in that situation, because it changes what actually happens (not just the performance).