Skip to content

Performance Issue with Foreman Detection #25

Description

@wmccrthy

Cross posting a bug report I was pinged about:

Heads up on a perf bug in the Mandolin extension (v0.0.1). On activation, getLutePath() looks for foreman.toml via vscode.workspace.findFiles(new RelativePattern(folder, "foreman.toml"), null, 1). Even though the glob is anchored to the workspace root, VS Code's findFiles shells out to ripgrep with --files --no-ignore --follow --hidden, which has to walk the entire workspace tree to apply the glob. I had Cursor opened on ~/codespace (which contains a couple of pnpm node_modules trees), and this pegged one rg process at ~1100% CPU for 12 minutes before I noticed and killed it — --no-ignore plus --follow chasing pnpm's symlink farms blows the search space up massively. Easy fix: since you only care whether /foreman.toml exists, replace the findFiles call with a vscode.workspace.fs.stat(vscode.Uri.file(/foreman.toml)) in a try/catch. Same semantics, O(1) per workspace folder, no ripgrep spawn.

Seems correct that we're wasting work by not excluding any globs from findFiles here, but odd that it resulted in a 12min process.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions