Join Slack
is the `pow` function slower than doing manual multiplication?
# random
r
Ray Rahke
05/07/2024, 6:53 AM
is the
pow
function slower than doing manual multiplication?
t
Tim McCormack
05/07/2024, 12:24 PM
That's the sort of thing you'd want to just run through a performance test.
Tim McCormack
05/07/2024, 12:24 PM
(Both to find out which is faster and, more importantly, to find out if there's even a performance issue to solve.)
Tim McCormack
05/07/2024, 12:26 PM
In the case of
pow
with a constant exponent, the compiler may even optimize it for you using square-and-multiply.
👆 3
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by