Hi,
I just wanted to ask which way is more efficient to return 360 degrees in CFrame.Angles (math.pi*2 or math.rad(360)) because I often use it and I don’t know which way should I use for better efficient.
I’m pretty sure they are both the same
4 Likes
Just make sure that you feel comfortable. It does not really matter if you use radians or degrees. They are just means to an end.
1 Like
No
Using one over the other will have no noticeable performance difference. Just choose the one you think looks nicer or is better for readability.
1 Like
Actually, it is.
3 Likes
You’ll notice no real difference, but I made a test to see which one was faster.
local BenchmarkTime1 = os.clock()
for i = 1,100000000 do
local Value = math.rad(360)
end
BenchmarkTime1 = os.clock() - BenchmarkTime1
local BenchmarkTime2 = os.clock()
for i = 1,100000000 do
local Value = math.pi*2
end
BenchmarkTime2 = os.clock() - BenchmarkTime2
print("math.rad time :"..BenchmarkTime1)
print("pi*2 time: "..BenchmarkTime2)
3 Likes