Posted 08 June 2015 - 06:17 PM
This might be off topic, as I know how to do this in computercraft but my question is about vanilla lua. I have a function and I want to see how long it takes to execute (To the millisecond)
This is my current code:
This is my current code:
function Test_Function()
for i = 1, 100 do
local s = math.log( i )
s = math.sqrt( s )
end
end
t1 = os.clock()
Test_Function()
t2 = os.clock()
print( os.difftime(t2, t1) )
However this is returning the amount of seconds it takes, not the amount of milliseconds. Is there a way to measure how long a function takes to executes to the millisecond in vanilla lua?