2025-06-11 20:16:52 -04:00
|
|
|
function bench(Function, ...)
|
|
|
|
|
local t = os.time()
|
|
|
|
|
local clock1 = os.clock()
|
|
|
|
|
Function(...)
|
2025-08-11 18:05:26 -07:00
|
|
|
local c = os.clock()-clock1
|
2025-06-11 20:16:52 -04:00
|
|
|
return os.time()-t, c
|
2023-07-01 11:58:00 -04:00
|
|
|
end
|
|
|
|
|
|
2025-06-11 20:16:52 -04:00
|
|
|
function sleep(n)
|
|
|
|
|
local start = os.time()
|
|
|
|
|
repeat until os.time()-start==n
|
|
|
|
|
end
|
2023-07-01 11:58:00 -04:00
|
|
|
|
2025-06-11 20:16:52 -04:00
|
|
|
print( bench(sleep, 2) )
|