Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant performance issue in LSP resolver #1493

Closed
logo749 opened this issue Jul 12, 2024 · 2 comments · Fixed by #1498 or #1522
Closed

Significant performance issue in LSP resolver #1493

logo749 opened this issue Jul 12, 2024 · 2 comments · Fixed by #1498 or #1522
Assignees
Labels
enhancement New feature or request lsp resolver semantic Issues or PRs related to kcl semantic and checker

Comments

@logo749
Copy link

logo749 commented Jul 12, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Open a big .k, with thousand nesting config
  2. The LSP will in resolver stage forever

2. What did you expect to see? (Required)

  1. LSP resolver end in reasonable time

3. What did you see instead (Required)

  1. LSP resolver run forever

4. What is your KCL components version? (Required)

0.9.0

I found the problem is in the walk_config_entries of the resolver process:

kcl-main/kclvm/sema/src/resolver/config.rs line: 521
image

walk_config_entries will travel all children twice, cause a child node be visited 2 * (parent count) count. In a deep tree, will become a big performance issue. In my case is a 2w+ line .k, 20+ depth

My question is:

  1. Is this expected behavior?
  2. Can I use the ty in node_ty_map, instead of travel all children again?
@Peefy
Copy link
Contributor

Peefy commented Jul 12, 2024

@logo749 Good Catch! 👍 PRs are also welcome. ❤️

cc @He1pa Can you help answer or troubleshoot the problem?

@Peefy Peefy added lsp semantic Issues or PRs related to kcl semantic and checker labels Jul 12, 2024
@Peefy Peefy added this to the v0.10.0 Release milestone Jul 12, 2024
@Peefy Peefy added resolver enhancement New feature or request labels Jul 12, 2024
@He1pa
Copy link
Contributor

He1pa commented Jul 15, 2024

Thanks for your feedback, I solved the issue of visiting the node twice in #1498.
And we track the overall performance issues of LSP in #1237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lsp resolver semantic Issues or PRs related to kcl semantic and checker
Projects
None yet
3 participants