summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-17 17:02:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-17 17:02:09 +0800
commitfaab8b0541b7eb3a955dfc231f91364f78d0fcb6 (patch)
tree3280248f56e6162a4ad120f250a556fc5698c7f5 /script-beta
parentd7e52dae048639fd7cbb5e04d377ea7f05f94ce2 (diff)
downloadlua-language-server-faab8b0541b7eb3a955dfc231f91364f78d0fcb6.zip
现在的瓶颈在类型推断上
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/vm/getInfer.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/script-beta/vm/getInfer.lua b/script-beta/vm/getInfer.lua
index 7eb65df4..0352e9d2 100644
--- a/script-beta/vm/getInfer.lua
+++ b/script-beta/vm/getInfer.lua
@@ -1,5 +1,6 @@
local vm = require 'vm.vm'
local guide = require 'parser.guide'
+local util = require 'utility'
NIL = setmetatable({'<nil>'}, { __tostring = function () return 'nil' end })
@@ -26,5 +27,11 @@ function vm.getInfers(source)
if not source then
return
end
- return guide.requestInfer(source, vm.interface)
+ local clock = os.clock()
+ local infers = guide.requestInfer(source, vm.interface)
+ local passed = os.clock() - clock
+ if passed > 0.1 then
+ log.warn(('Request infer takes [%.3f]sec! %s'):format(passed, util.dump(source, { deep = 1 })))
+ end
+ return infers
end