From b62eba6d93fc026873d29dc865cd3f745cb403fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 5 Jan 2021 21:23:38 +0800 Subject: improve performance --- test/full/example.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'test/full/example.lua') diff --git a/test/full/example.lua b/test/full/example.lua index 4f6090ee..a7df10db 100644 --- a/test/full/example.lua +++ b/test/full/example.lua @@ -3,6 +3,8 @@ local parser = require 'parser' local files = require 'files' local diag = require 'core.diagnostics' local config = require 'config' +local fs = require 'bee.filesystem' +local luadoc = require "parser.luadoc" -- 临时 local function testIfExit(path) @@ -16,23 +18,29 @@ local function testIfExit(path) local need local parseClock = 0 local compileClock = 0 + local luadocClock = 0 local total for i = 1, max do vm = TEST(buf) + local luadocStart = os.clock() + luadoc(nil, vm) + local luadocPassed = os.clock() - luadocStart local passed = os.clock() - clock - parseClock = parseClock + vm.parseClock + parseClock = parseClock + vm.parseClock compileClock = compileClock + vm.compileClock + luadocClock = luadocClock + luadocPassed if passed >= 1.0 or i == max then need = passed / i total = i break end end - print(('基准编译测试[%s]单次耗时:%.10f(解析:%.10f, 编译:%.10f)'):format( + print(('基准编译测试[%s]单次耗时:%.10f(解析:%.10f, 编译:%.10f, LuaDoc: %.10f)'):format( path:filename():string(), need, parseClock / total, - compileClock / total + compileClock / total, + luadocClock / total )) local clock = os.clock() @@ -58,3 +66,4 @@ require 'tracy' .enable() testIfExit(ROOT / 'test' / 'example' / 'vm.txt') testIfExit(ROOT / 'test' / 'example' / 'largeGlobal.txt') testIfExit(ROOT / 'test' / 'example' / 'guide.txt') +testIfExit(fs.path [[D:\github\test\ECObject.lua]]) -- cgit v1.2.3