diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 00:00:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 00:00:30 +0800 |
commit | 0a60aa17c240d4fb080b091891f659a9d74aeffd (patch) | |
tree | 16b60ded672bf0d895cdb659ae89902ddbce5db1 /test | |
parent | c2a8838012780eb57fa7de36ae0cfa6fd4388b96 (diff) | |
download | lua-language-server-0a60aa17c240d4fb080b091891f659a9d74aeffd.zip |
update
Diffstat (limited to 'test')
-rw-r--r-- | test/full/example.lua | 14 | ||||
-rw-r--r-- | test/full/init.lua | 7 |
2 files changed, 9 insertions, 12 deletions
diff --git a/test/full/example.lua b/test/full/example.lua index 5596233e..20de5528 100644 --- a/test/full/example.lua +++ b/test/full/example.lua @@ -12,26 +12,24 @@ local function testIfExit(path) config.set('Lua.workspace.preloadFileSize', 1000000000) local buf = util.loadFile(path:string()) if buf then - local vm + local state local clock = os.clock() local max = 1 local need - local parseClock = 0 local compileClock = 0 local luadocClock = 0 local noderClock = 0 local total for i = 1, max do - vm = TEST(buf) + state = TEST(buf) local luadocStart = os.clock() - luadoc(nil, vm) + luadoc(state) local luadocPassed = os.clock() - luadocStart local passed = os.clock() - clock local noderStart = os.clock() local noderPassed = os.clock() - noderStart - parseClock = parseClock + vm.parseClock - compileClock = compileClock + vm.compileClock + compileClock = compileClock + state.compileClock luadocClock = luadocClock + luadocPassed noderClock = noderClock + noderPassed if passed >= 1.0 or i == max then @@ -40,10 +38,9 @@ local function testIfExit(path) break end end - print(('基准编译测试[%s]单次耗时:%.10f(解析:%.10f, 编译:%.10f, LuaDoc: %.10f, Noder: %.10f)'):format( + print(('基准编译测试[%s]单次耗时:%.10f(解析:%.10f, LuaDoc: %.10f, Noder: %.10f)'):format( path:filename():string(), need, - parseClock / total, compileClock / total, luadocClock / total, noderClock / total @@ -52,7 +49,6 @@ local function testIfExit(path) local clock = os.clock() local max = 100 local need - local lines = parser:lines(buf) for i = 1, max do files.removeAll() files.open('') diff --git a/test/full/init.lua b/test/full/init.lua index 89d9b8b3..9584db6f 100644 --- a/test/full/init.lua +++ b/test/full/init.lua @@ -5,9 +5,10 @@ local util = require 'utility' rawset(_G, 'TEST', true) function TEST(script) - local ast = parser:compile(script, 'lua', 'Lua 5.3') - assert(ast) - return ast + local clock = os.clock() + local state = parser.compile(script, 'Lua', 'Lua 5.3') + state.compileClock = os.clock() - clock + return state end local function startCollectDiagTimes() |