Skip to content

Dart LSP slow startup/first response on large codebase #52947

Open
@RobertBrunhage

Description

@RobertBrunhage

Dart SDK version: 3.0.6 (stable) (Tue Jul 11 18:49:07 2023 +0000) on "macos_arm64"

LSP takes a long time before LSP actions work

Not sure how to debug this so if you have tips/approaches, please let me know!

In short, when I open a project with Neovim the dartls LSP starts and in a large project takes towards half a minute for anything related to the LSP to work (hover docs, code completion, code actions etc).

Below I added duration for dart analyze with time dart analyze with a small project and large project to see the difference. Not sure if this command is even helpful in debugging but at least it shows the difference I experience.

Small project

real    0.65s
user    0.48s
sys     0.35s
cpu     127%

Large project

real    31.19s
user    33.99s
sys     8.12s
cpu     135%

The large project contains, internal packages and is in general very large (>690k LOC counted with find . -name '*.dart' | xargs wc -l), but I would still expect it to be faster than 30 seconds for anything to work, and the subsequent action takes ~half the time of that (18 seconds). After those two (first 30 sec wait for a LSP action, and then 18 sec, it becomes almost instant).

Again, if there are better ways to debug this, please let me know.

I will add this here as well as that is where I got the config from (mine is a bit leaner as I don't use outline etc.
https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua


Tweet referencing this issue -> https://twitter.com/RobertBrunhage/status/1680840204309913600

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-serverIssues related to some aspect of the analysis servertype-performanceIssue relates to performance or code size

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions