diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-16 20:41:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-16 20:41:24 +0800 |
commit | 23eac92eb9e6cb133336f67e104c00b9f200cb5b (patch) | |
tree | 9c1dbf9b144c8c34805123107eccb7956dcd10a3 | |
parent | 9c6e2784fa796777bed2d4ba17f706d2c6a0bc67 (diff) | |
download | lua-language-server-23eac92eb9e6cb133336f67e104c00b9f200cb5b.zip |
test performance
-rw-r--r-- | .vscode/launch.json | 2 | ||||
-rw-r--r-- | script/core/completion.lua | 6 | ||||
-rw-r--r-- | script/core/diagnostics/init.lua | 3 | ||||
-rw-r--r-- | script/utility.lua | 4 | ||||
-rw-r--r-- | test/full/init.lua | 18 | ||||
-rw-r--r-- | test/full/projects.lua | 4 |
6 files changed, 32 insertions, 5 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 0826aeb6..3ba84cd2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,7 +30,7 @@ "type": "lua", "request": "attach", "stopOnEntry": true, - "address": "127.0.0.1:11489", + "address": "127.0.0.1:11413", "outputCapture": [ ], "sourceMaps": [ diff --git a/script/core/completion.lua b/script/core/completion.lua index 9f35c4ac..d261b302 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -132,6 +132,9 @@ local function buildFunctionSnip(source, value, oop) end local function buildDetail(source) + if source.type == 'dummy' then + return + end local types = infer.searchAndViewInfers(source) local literals = infer.searchAndViewLiterals(source) if literals then @@ -170,6 +173,9 @@ local function getSnip(source) end local function buildDesc(source) + if source.type == 'dummy' then + return + end local hover = getHover.get(source) local md = markdown() md:add('lua', hover.label) diff --git a/script/core/diagnostics/init.lua b/script/core/diagnostics/init.lua index 82107a2d..5446a7c3 100644 --- a/script/core/diagnostics/init.lua +++ b/script/core/diagnostics/init.lua @@ -59,6 +59,9 @@ local function check(uri, name, results) if passed >= 0.5 then log.warn(('Diagnostics [%s] @ [%s] takes [%.3f] sec!'):format(name, uri, passed)) end + if DIAGTIMES then + DIAGTIMES[name] = (DIAGTIMES[name] or 0) + passed + end end return function (uri, response) diff --git a/script/utility.lua b/script/utility.lua index 04597a39..16c5e0c9 100644 --- a/script/utility.lua +++ b/script/utility.lua @@ -317,12 +317,12 @@ end --- 排序后遍历 ---@param t table -function m.sortPairs(t) +function m.sortPairs(t, sorter) local keys = {} for k in pairs(t) do keys[#keys+1] = k end - tableSort(keys) + tableSort(keys, sorter) local i = 0 return function () i = i + 1 diff --git a/test/full/init.lua b/test/full/init.lua index f292a573..b410e3b3 100644 --- a/test/full/init.lua +++ b/test/full/init.lua @@ -1,4 +1,6 @@ local parser = require 'parser' +local config = require 'config' +local util = require 'utility' rawset(_G, 'TEST', true) @@ -8,8 +10,24 @@ function TEST(script) return ast end +local function startCollectDiagTimes() + for name in pairs(config.config.diagnostics.neededFileStatus) do + if name ~= 'no-implicit-any' then + config.config.diagnostics.neededFileStatus[name] = 'Any' + end + end + DIAGTIMES = {} +end + require 'full.normal' require 'full.example' require 'full.dirty' require 'full.projects' +startCollectDiagTimes() require 'full.self' + +for name, time in util.sortPairs(DIAGTIMES, function (k1, k2) + return DIAGTIMES[k1] < DIAGTIMES[k2] +end) do + print('诊断任务耗时:', name, time) +end diff --git a/test/full/projects.lua b/test/full/projects.lua index 9543f525..54192ee7 100644 --- a/test/full/projects.lua +++ b/test/full/projects.lua @@ -39,5 +39,5 @@ local function doProjects(pathname) print('基准全量诊断用时:', passed) end -doProjects [[C:\SSSEditor\client\Output\Lua]] -doProjects [[C:\W3-Server\script]] +--doProjects [[C:\SSSEditor\client\Output\Lua]] +--doProjects [[C:\W3-Server\script]] |