2023-01-14 01:57:12 +08:00
|
|
|
-- 记录开始时间
|
|
|
|
local starttime = os.clock(); --> os.clock()用法
|
2023-01-08 15:07:12 +08:00
|
|
|
|
2023-01-14 17:16:49 +08:00
|
|
|
local str = 'test'
|
|
|
|
local len = #str
|
2023-01-14 14:22:25 +08:00
|
|
|
|
2023-01-14 17:16:49 +08:00
|
|
|
for i = 1, 100000000 do
|
|
|
|
local size = len
|
|
|
|
end
|
2023-01-10 14:40:28 +08:00
|
|
|
|
2023-01-14 01:57:12 +08:00
|
|
|
-- 记录结束时间
|
|
|
|
local endtime = os.clock(); --> os.clock()用法
|
|
|
|
print(string.format("end time : %.4f", endtime));
|
|
|
|
print(string.format("cost time : %.4f", endtime - starttime));
|