LuaLS / LuaLS/lua-language-server

性能问题 CPU占用高

Open
#2,803 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Other

Expected Behaviour

CPU 占用不应该偏高

Actual Behaviour

当项目和单个文件有一定的规模时,CPU 占用偏高

Reproduction steps
  1. 项目整体规模有一定的影响。以下是项目大概规模
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Lua                            186           9067          25097          31556
  1. 单个文件大小是主要因素。问题明显出现是在一个用于临时测试的文件,该文件有 6000 多行,其中主要为 if 结构,包含约 330 个测试分支。在这个文件中一旦编辑一下,lua-language-server.exe 就 CPU 占用较高, 5%-9% 左右,散热风扇就开始转很快,补全和提示就会产生严重延迟。
  2. 当前文件不大时没有问题。
Additional Notes

No response

Log File

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Reproduce on Windows with the reported 6,000-line Lua file and roughly 330 branches, then investigate the language server's CPU usage after edits; done means lower CPU usage without the reported completion and diagnostic delays.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.