summaryrefslogtreecommitdiff
path: root/test/full/example.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/full/example.lua')
-rw-r--r--test/full/example.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/full/example.lua b/test/full/example.lua
index e409b4b2..b19f0485 100644
--- a/test/full/example.lua
+++ b/test/full/example.lua
@@ -14,15 +14,26 @@ local function testIfExit(path)
local clock = os.clock()
local max = 100
local need
+ local parseClock = 0
+ local compileClock = 0
+ local total
for i = 1, max do
vm = TEST(buf)
local passed = os.clock() - clock
+ parseClock = parseClock + vm.parseClock
+ compileClock = compileClock + vm.compileClock
if passed >= 1.0 or i == max then
need = passed / i
+ total = i
break
end
end
- print(('基准编译测试[%s]单次耗时:%.10f'):format(path:filename():string(), need))
+ print(('基准编译测试[%s]单次耗时:%.10f(解析:%.10f, 编译:%.10f)'):format(
+ path:filename():string(),
+ need,
+ parseClock / total,
+ compileClock / total
+ ))
local clock = os.clock()
local max = 100
@@ -43,3 +54,4 @@ local function testIfExit(path)
end
testIfExit(ROOT / 'test' / 'example' / 'vm.txt')
testIfExit(ROOT / 'test' / 'example' / 'largeGlobal.txt')
+testIfExit(ROOT / 'test' / 'example' / 'guide.txt')