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

Overhaul workspace search for symbol references #1917

Merged

Conversation

SeeminglyScience
Copy link
Collaborator

PR Summary

Dependent on PowerShell/vscode-powershell#4170

Significantly reduce performance overhead of reference finding in large workspaces.

PR Context

This PR has the following changes:

  1. Adds a reference cache to every ScriptFile
  2. Workspace scan is performed only once on first request
  3. An LSP file system watcher provides updates for files not changed via Did*TextDocument notifications
  4. Adds a setting to only search "open documents" for references. This disables both the initial workspace scan and the file system watcher, relying only on Did*TextDocument notifications.

As a stress test I opened up my profile directory (which has ~3k script files in total in the Modules directory) and created a file with a function definition on every line. I then tabbed to a different file, and then tabbed back to the new file. Before the changes, the references code lens took ~10 seconds to populate and my CPU spiked to ~50% usage. After the changes, they populated instantly and CPU spiked to ~2% usage.

Copy link
Member

@andyleejordan andyleejordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

SeeminglyScience and others added 2 commits September 14, 2022 14:14
…ndHelpers.cs

Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com>
…ndHelpers.cs

Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com>
@andyleejordan andyleejordan enabled auto-merge (squash) September 14, 2022 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Symbols and References Issue-Enhancement A feature request (enhancement).
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants