3 ms·
Well ok but (x*3)/3 will be a lot worse :)
by millstone 8y ago
Well ok but (x*3)/3 will be a lot worse :)
- Franciscouzo 8y agoNot by a lot, the divide by constant can be optimized to a multiplication, if you're doing it in a loop (why would you care if you do it only once), you can reach a throughput of one multiplication per cycle, so (x*3)/3 would take 2 cycles on average.
- millstone 8y agoThis is a silly line of argument; optimizing (x*3)/3 to x unlocks further CSE, inlining, etc. so the benefit may be arbitrarily large. Rust made the right tradeoff here but it is a tradeoff!