summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-05 21:23:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-05 21:23:38 +0800
commitb62eba6d93fc026873d29dc865cd3f745cb403fd (patch)
tree9ddb1bb78113f8201e634a2e3c305f4e0985d02f /script/files.lua
parenta6cfc1162c24e1621076bc96b36768873bbaf9d4 (diff)
downloadlua-language-server-b62eba6d93fc026873d29dc865cd3f745cb403fd.zip
improve performance
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/files.lua b/script/files.lua
index 8a16edbe..fd9a55ab 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -103,6 +103,7 @@ function m.setText(uri, text)
if not text then
return
end
+ --log.debug('setText', uri)
local originUri = uri
uri = getUriKey(uri)
local create
@@ -284,7 +285,12 @@ function m.compileAst(uri, text)
if state then
state.uri = uri
state.ast.uri = uri
+ local clock = os.clock()
parser:luadoc(state)
+ local passed = os.clock() - clock
+ if passed > 0.1 then
+ log.warn(('Parse LuaDoc of [%s] takes [%.3f] sec, size [%.3f] kb.'):format(uri, passed, #text / 1000))
+ end
return state
else
log.error(err)