You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Luau, the difference is smaller than in Lua 5.3 maybe due to fastcall, but there is still a function call overhead, so converting math.sqrt(x) to (x)^.5 may be helpful for (micro) optimization. (I actually did some benchmarking.)
The edge case of conversion is that the result after converting math.sqrt(x) to (x)^.5 can be different depending on the type and version of Lua. I have tested in advance that 1:1 conversion works well in both Lua 5.3 and Luau.
A rule name could be convert_sqrt or convert_math_sqrt.
The text was updated successfully, but these errors were encountered:
In Luau, the difference is smaller than in Lua 5.3 maybe due to fastcall, but there is still a function call overhead, so converting
math.sqrt(x)
to(x)^.5
may be helpful for (micro) optimization. (I actually did some benchmarking.)Benchmarking code
Lua 5.3
Luau
The edge case of conversion is that the result after converting
math.sqrt(x)
to(x)^.5
can be different depending on the type and version of Lua. I have tested in advance that 1:1 conversion works well in both Lua 5.3 and Luau.A rule name could be
convert_sqrt
orconvert_math_sqrt
.The text was updated successfully, but these errors were encountered: