diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-12 13:44:44 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-12 13:44:44 +0800 |
commit | 90fede5418b7c612ca18821e4616664acf11783e (patch) | |
tree | cf8da57e61feeed67300566dbffe4669986b3ab7 /server/test/full/example.lua | |
parent | f9dde0cfbfc3a76f5fb751e01f7c372d13a302b2 (diff) | |
download | lua-language-server-90fede5418b7c612ca18821e4616664acf11783e.zip |
全局变量清理info使用标记,加快大量全局变量的操作速度
Diffstat (limited to 'server/test/full/example.lua')
-rw-r--r-- | server/test/full/example.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server/test/full/example.lua b/server/test/full/example.lua index cf23335c..2a84de2a 100644 --- a/server/test/full/example.lua +++ b/server/test/full/example.lua @@ -7,10 +7,18 @@ local function testIfExit(path) local buf = io.load(fs.path(path)) if buf then local clock = os.clock() - for _ = 1, 10 do + local max = 100 + local need + for i = 1, max do TEST(buf) + local passed = os.clock() - clock + if (passed >= 1.0 and i >= 3) or i == max then + need = passed / i + break + end end - print('基准测试耗时:', os.clock() - clock) + print(('基准测试[%s]单次耗时:%.10f'):format(path:filename():string(), need)) end end testIfExit(ROOT / 'test' / 'example' / 'vm.txt') +testIfExit(ROOT / 'test' / 'example' / 'largeGlobal.txt') |