summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-11 18:43:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-11 18:43:13 +0800
commit710ca85aebe3b761e8f03462651ba8ecf629518a (patch)
tree48565c777be10496275357f0cd6a0701bef27ef9
parent650af818eb185d3261648cac615e9f8ce99b0d50 (diff)
downloadlua-language-server-710ca85aebe3b761e8f03462651ba8ecf629518a.zip
stash
-rw-r--r--script/core/searcher.lua10
-rw-r--r--test.lua1
-rw-r--r--test/full/self.lua2
3 files changed, 12 insertions, 1 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 73e9ca0f..c782e68c 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -430,6 +430,7 @@ function m.searchRefsByID(status, uri, expect, mode)
if not uris then
return
end
+ local clock = os.clock()
local isCall = id:sub(#firstID + 2, #firstID + 2) == noder.RETURN_INDEX
local tid = id .. (field or '')
for guri, def in pairs(uris) do
@@ -452,6 +453,10 @@ function m.searchRefsByID(status, uri, expect, mode)
crossSearch(status, guri, tid, mode)
::CONTINUE::
end
+ local passed = os.clock() - clock
+ if passed > 0.1 then
+ print('全局变量耗时:', passed, id, field, tid, mode)
+ end
end
local function checkClass(id, node, field)
@@ -530,7 +535,9 @@ function m.searchRefsByID(status, uri, expect, mode)
local stepCount = 0
function searchStep(id, field)
stepCount = stepCount + 1
- if stepCount > 1000 then
+ --status.count = status.count + 1
+ if stepCount > 1000
+ or status.count > 10000 then
if TEST then
error('too large!')
else
@@ -749,6 +756,7 @@ function m.status(mode)
lock = {},
results = {},
mark = {},
+ count = 0,
cache = vm.getCache('searcher:' .. mode)
}
return status
diff --git a/test.lua b/test.lua
index fe998a89..94c5bcf7 100644
--- a/test.lua
+++ b/test.lua
@@ -89,6 +89,7 @@ local function main()
--config.config.intelliSense.searchDepth = 5
loadDocMetas()
+ test 'full'
require 'bee.platform'.OS = 'Windows'
testAll()
require 'bee.platform'.OS = 'Linux'
diff --git a/test/full/self.lua b/test/full/self.lua
index 5b1b2514..9a26cb04 100644
--- a/test/full/self.lua
+++ b/test/full/self.lua
@@ -22,7 +22,9 @@ diag.start()
local clock = os.clock()
for uri in files.eachFile() do
+ local fileClock = os.clock()
diag.doDiagnostic(uri)
+ print('诊断文件耗时:', os.clock() - fileClock, uri)
end
local passed = os.clock() - clock