Skip to content

Severe performance issues (on remote filesystem) on keypress due to run-test-at-cursor checks #1441

@DanTup

Description

@DanTup

Reported by @bwlk in Gitter:

Since upgrading to 2.22, my performance using the extension has been unusable, and I get constant "UNRESPONSIVE extension host" warnings in my window log output.

I've tracked it down to the vs.window.onDidChangeTextEditorSelection listener in TestCommands. This triggers on every cursor movement, including typing a key.

The listener calls locateBestProjectRoot, which loops through every ancestor directory of current file and calls hasPubspec and hasPackagesFile. For many of my files, the directory tree is a dozen+ levels deep.

hasPubspec and hasPackagesFile each calls fs.existsSync, which is a blocking call. fs.existsSync takes around 50ms to complete. It may be slower for me than most others because I'm working on a project in a mounted remote filesystem.

So adding all this up, on every cursor movement or keypress for me, the extension blocks for 1-2 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions