-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: semantic tokens performance (#3932)
While implementing #3925, I noticed that the performance of the `textDocument/semanticTokens/full` request is *extremely* bad due to a quadratic implementation. Specifically, on my machine, computing the full semantic tokens for `Lean/Elab/Do.lean` took a full 5s. In practice, this means that while elaborating the file, one core is entirely busy with computing the semantic tokens for the file. This PR fixes this performance bug by re-implementing the semantic token handling, reducing the latency for `Lean/Elab/Do.lean` from 5s to 60ms. As a result, the overly cautious refresh latency of 5s in #3925 can easily be reduced to 2s again. Since the previous semantic tokens implementation used a very brittle hack to identify projections, this PR also changes the projection notation elaboration to augment the `InfoTree` syntax for the field of a projection with a special syntax node of kind `Lean.Parser.Term.identProjKind`. With this syntax kind, projection fields can now easily be identified in the `InfoTree`.
- Loading branch information
Showing
5 changed files
with
152 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters