diff options
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r-- | script/core/searcher.lua | 10 |
1 files changed, 9 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 |