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

Typescript server is slow on Zed when compared to VSCode #18698

Open
1 task done
baptisteArno opened this issue Oct 3, 2024 · 16 comments
Open
1 task done

Typescript server is slow on Zed when compared to VSCode #18698

baptisteArno opened this issue Oct 3, 2024 · 16 comments
Labels
language server An umbrella label for all language servers large projects For anything relating to large volumes of files or multiple subprojects in one main project. performance Feedback for performance issues, speed, memory usage, etc reproducible Verified steps to reproduce included typescript TypeScript programming language support

Comments

@baptisteArno
Copy link

baptisteArno commented Oct 3, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

The coding experience in a large Typescript monorepo (https://github.com/baptisteArno/typebot.io) is still an issue for me even though it now uses the vtsls, I still don't get the same speed as VSCode or even NeoVim (with vtsls lsp)

I'm just helpless, what is doing Zed that could cause this code error refresh so slow?

This also can be linked with:

Environment

Zed: v0.156.0 (Zed Preview)
OS: macOS 15.0.0
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

VSCode:

CleanShot.2024-10-03.at.17.02.42.mp4

Zed:

CleanShot.2024-10-03.at.17.04.27.mp4

If applicable, attach your Zed.log file to this issue.

No response

@osiewicz
Copy link
Contributor

osiewicz commented Oct 3, 2024

Could you also record a comparison with Neovim + VTSLS? VSC uses tsserver directly.

@baptisteArno
Copy link
Author

CleanShot.2024-10-03.at.19.57.36.mp4

LazyVim distro with that lsp config override:

return {
  "neovim/nvim-lspconfig",
  opts = function(_, opts)
    opts.inlay_hints.enabled = false
    opts.servers.vtsls.settings.typescript.tsserver = {
      experimental = {
        enableProjectDiagnostics = false,
      },
    }

    opts.servers.vtsls.autoUseWorkspaceTsdk = true

    return opts
  end,
}

@baptisteArno
Copy link
Author

baptisteArno commented Oct 3, 2024

But as you can see in Zed, I'm hovering my mouse over the sessionState variable and it gives me the proper type so I guess that the LSP is up to date but Zed decides not to update the diagnostic overlay directly?

@notpeter notpeter added performance Feedback for performance issues, speed, memory usage, etc typescript TypeScript programming language support language server An umbrella label for all language servers large projects For anything relating to large volumes of files or multiple subprojects in one main project. and removed triage labels Oct 13, 2024
@juanpmarin
Copy link

juanpmarin commented Oct 24, 2024

Same issue here, I'm running zed on fedora linux

@chungweileong94
Copy link
Contributor

Been facing the same issue for the past few months. The only workaround right now is to restart the LSPs once in a while.

@chungweileong94
Copy link
Contributor

chungweileong94 commented Nov 7, 2024

I found this PR from vtsls. It seems Electron came with an unofficial Node version that came with pointer compression, which is also what VSCode is using. I played with it for a while. It does seem like the memory is relatively smaller, but I haven't really started coding with it.

Screen.Recording.2024-11-07.at.9.49.32.PM.mov

[UPDATE] After trying to open files from at least 10 different sub-repos, I can see the tsserver memory usage cut nearly half, from 3GB~ down to 1GB~.

@chungweileong94
Copy link
Contributor

I'm not sure if this is good enough to reproduce the problem, but if you have a really large monorepo, try opening multiple files from multiple different sub-repos, and you will start noticing that the node memory usage will start to build up, which I think tsserver will likely get slow and unusable like the issue described.

@wesleyguirra
Copy link

Also happening for me

@baptisteArno
Copy link
Author

I wanted to give it another shot. New Zed install, dumb example but it's like this everywhere:

CleanShot.2025-02-23.at.16.29.02.mp4

Compared with Cursor (or VSCode):

CleanShot.2025-02-23.at.16.29.24.mp4

Guys... How is it not a priority? The reproduction is dead simple. Too bad Zed is so fast but the LSP refresh is total garbage??

@osiewicz, did you manage to reproduce? Clone this https://github.com/baptisteArno/typebot.io (or any non-toy typescript project)

@baptisteArno
Copy link
Author

@beniaminzagan beniaminzagan added reproducible Verified steps to reproduce included and removed bug [core label] labels Feb 23, 2025
@aevsai
Copy link

aevsai commented Feb 24, 2025

ok, i found what was wrong in my case, zed's default memory limit is different for vtsls and typescript-language-server
you can test if it's works for your case by setting lsp settings to:

"lsp": {
  "vtsls": {
      "settings": {
        "tsserver": {
          "maxTsServerMemory": 8092
        }
      }
    }
}

I'd offer that we set vtsls memory limit same as typescript-language-server
#25442

@chungweileong94
Copy link
Contributor

chungweileong94 commented Feb 24, 2025

ok, i found what was wrong in my case, zed's default memory limit is different for vtsls and typescript-language-server you can test if it's works for your case by setting lsp settings to:

"lsp": {
  "vtsls": {
      "settings": {
        "tsserver": {
          "maxTsServerMemory": 8092
        }
      }
    }
}

I'd offer that we set vtsls memory limit same as typescript-language-server #25442

Interesting, I always though that Zed default the vtsls max memory to 8092, but it doesn't seems to be the case according to your PR🤔
https://zed.dev/docs/languages/typescript#large-projects

[EDIT]
Actually, I think the max memory is set correctly for vtsls, which is 8092 (https://github.com/zed-industries/zed/pull/17354/files). You probably got confuse by the Zed LSP settings hierarchy.

@aevsai
Copy link

aevsai commented Feb 24, 2025

then

ok, i found what was wrong in my case, zed's default memory limit is different for vtsls and typescript-language-server you can test if it's works for your case by setting lsp settings to:

"lsp": {
  "vtsls": {
      "settings": {
        "tsserver": {
          "maxTsServerMemory": 8092
        }
      }
    }
}

I'd offer that we set vtsls memory limit same as typescript-language-server #25442

Interesting, I always though that Zed default the vtsls max memory to 8092, but it doesn't seems to be the case according to your PR🤔 https://zed.dev/docs/languages/typescript#large-projects

[EDIT] Actually, I think the max memory is set correctly for vtsls, which is 8092 (https://github.com/zed-industries/zed/pull/17354/files). You probably got confuse by the Zed LSP settings hierarchy.

then i actually not sure what and where went wrong 😵‍💫, bc i tested locally and performance on my repo become great after i edited settings. And that worked in both cases: when it set as defaults in zed and when i edit settings

@chungweileong94
Copy link
Contributor

Based on my experience, I don't think memory is the problem here, where one of my monorepos(about 20+ sub-repos) always uses about 5GB at max, which it doesn't even hit the VTSL server max memory. And there is no problem with inspect types, go to definition, etc., not until I start changing some code, where the LSP will slowly fall apart.

@baptisteArno
Copy link
Author

Memory is not the issue. On nvim with vtsls with default memory limit (4Go), there is no issue.

@aevsai
Copy link

aevsai commented Feb 24, 2025

Memory is not the issue. On nvim with vtsls with default memory limit (4Go), there is no issue.

maybe my issue was not related from the beginning 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language server An umbrella label for all language servers large projects For anything relating to large volumes of files or multiple subprojects in one main project. performance Feedback for performance issues, speed, memory usage, etc reproducible Verified steps to reproduce included typescript TypeScript programming language support
Projects
None yet
Development

No branches or pull requests

8 participants