I am running this bellow script and i get weird timers and i do not understand why.
Vector2 seems so slow compared to Vector3 when i think it should be faster.
local times = 10000000
--------------------------------------------------------- Vector2 Creation
local t = os.clock()
for i = 0, times do
local shipVec = Vector2.new(i,i)
end
local ft = os.clock()
print("Vector2 Creation", ft - t)
--------------------------------------------------------- Vector3 Creation
local t = os.clock()
for i = 0, times do
local shipVec = Vector3.new(i,i,i)
end
local ft = os.clock()
print("Vector3 Creation", ft - t)
Results:
Vector2 Creation 0.479585999622941
Vector3 Creation 0.08559640031307936
Is there something i am missing or it is only about internal optimization inside roblox code?