LuaLS / LuaLS/lua-language-server

[Question] Large size type annotation file cause low performance. Is it possible to fix it?

Open
#2,674 1 comment 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

In my project I have a special Lua file used to give type hint, it defines many field such as:
```
---@class UnityEngine.TransitionType
---@field Normal UnityEngine.TransitionType
---@field Entry UnityEngine.TransitionType
---@field Exit UnityEngine.TransitionType
UnityEngine.TransitionType = {}

---@class UnityEngine.StateInfoIndex
---@field CurrentState UnityEngine.StateInfoIndex
---@field NextState UnityEngine.StateInfoIndex
---@field ExitState UnityEngine.StateInfoIndex
---@field InterruptedState UnityEngine.StateInfoIndex
UnityEngine.StateInfoIndex = {}

--- ...more below
```
It contains all type using in my project so it's very large (about 5000KB), and caused low diagnostic speed when LLS runs.
Is it possible to optimize performance for those special type annotation file? Or I have to simplify this Lua file.

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

Reproduce the slowdown with the reported 5,000 KB Lua type-annotation file and compare diagnostic speed against a smaller file. Trace the diagnostic path that processes the annotations; done means the large-file case has substantially improved performance without losing type information.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.