top | item 45654396

(no title)

YesThatTom2 | 4 months ago

This is a good reminder that optimization without measurement is stupidity.

It’s also a reminder that compilers aren’t magic and optimizers aren’t all-knowing.

People have a tendency to ascribe magical properties to anything they don’t understand. Compilers and optimizers more so.

Measure before and after any optimization. You’d be surprised at what does and doesn’t improve efficiency.

Today’s CPUs are more complex than a human can understand.

Measure twice, cut once.

discuss

order

pjmlp|4 months ago

Worse is the cargo cult of "write this way because it is faster", without any measurements.

Only because it used to be true in the past, someone told it was so during a coffee break, or it appeared in some computer related article.

superblas|4 months ago

Agreed. As an embedded software engineer new to the field I’ve seen senior engineers with over ten years of experience complain when division by a compile time constant (even by a power of two) is used in code instead of multiplication or bit shifting on our cortex-m7 mcu running at 600MHz