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

VScode freezes when displaying long symbol lists in "Go to symbol search" #36941

Closed
SirIntruder opened this issue Oct 25, 2017 · 5 comments
Closed
Assignees
Labels
editor-symbols definitions, declarations, references freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues

Comments

@SirIntruder
Copy link

  • VSCode Version: 17.2 (both stable and insiders build)
  • OS Version: Windows 10
  • Language: C#

Steps to Reproduce:

  1. Have a workspace with ~20.000 or more symbols. Or alternatively, have WorkspaceSymbolProvider that produces same amount of dummy symbols. It doesn't seem to make a difference
  2. Start "Go to symbol" seach (Ctrl+T)

Result:
Up to some amount of symbols, find symbols was reasonably responsive. Than it starts to drop as you add more symbols, While symbol list is being processed, VSCode CPU usage spikes, and VSCode is completely unresponsive for X amount of seconds, where X appears to grow exponentially with amount of symbols.

At 50.000 symbols I got a "page is unresponsive" dialog after waiting for a minute or so.

Also, dismissing resulting symbol list in the ui is very slow as well.
2017-10-25_22-54-36

Is this omnisharp-vscode fault?

This was my suspicion, but after tinkering a bit I think it is a vscode issue.

Since I am developing in c#, omnisharp-vscode is implementation of WorkspaceSymbolProvider I use. This is their implementation.

I added some logs there and it appears that both symbol providing by omnisharp language server, and mapping of symbol objects are done almost instantly. VSCode becomes unresponsive while processing the returned list.

Fact that dismission of symbol list lasted for 4 seconds makes me think this has something to do with having huge amount of items in the dropdown

Conclusion

Minimum I would expect is to not have VScode frozen/unresponsive when displaying huge amount of symbols. Currently you are stuck with waiting for vscode to display ALL symbols before you even get a chance to narrow down search terms. And you have to wait AGAIN if you clear search terms to type another.

I fixed problem for myself by not returning anything when search string is empty, thus avoiding to wait for 32200 symbols I have in my main project, but I believe there should be better support for this problem on vscode side.

@dbaeumer
Copy link
Member

//cc @bpasero this could be our picker code as well.

@jrieken jrieken added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Oct 26, 2017
@jrieken
Copy link
Member

jrieken commented Oct 26, 2017

@SirIntruder Can you share that workspace with us or can you create a performance profile when doing this? This guide shows you how to do it: https://github.com/Microsoft/vscode/wiki/Performance-Issues#profile-a-vs-code-window

@jrieken
Copy link
Member

jrieken commented Oct 26, 2017

I can reproduce with the snippet below... Lot's of time is spend in IPC'ing and tracking the data:
CPU-20171026T103002.cpuprofile.txt

    vscode.languages.registerWorkspaceSymbolProvider({
        provideWorkspaceSymbols() {

            let n = 30000;
            let words = ['Foo', 'Provider', 'Abstract', 'Deletgate', 'Impl', 'Bar', 'Baz', 'Registry', 'TextSource', 'Factory'];
            let result = new Array<vscode.SymbolInformation>();

            while (n-- >= 0) {
                let name = words[Math.floor(Math.random() * words.length)] + words[Math.floor(Math.random() * words.length)];
                result.push(new vscode.SymbolInformation(name, vscode.SymbolKind.Struct, 'someParent', new vscode.Location(vscode.Uri.parse('some:file/' + n), new vscode.Position(0, 0))));
            }

            return result;
        }
    })

@jrieken
Copy link
Member

jrieken commented Oct 26, 2017

I have pushed some changes that improve this from holy-crap-slow to just slow. There are still issues with parsing all that data (~1sec) and the tree widget isn't fast (~4sec). See #36972 and #18180

@jrieken jrieken added the editor-symbols definitions, declarations, references label Oct 26, 2017
@jrieken
Copy link
Member

jrieken commented Oct 26, 2017

I am closing this as a dupe of the issues mentioned above

@jrieken jrieken closed this as completed Oct 26, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-symbols definitions, declarations, references freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues
Projects
None yet
Development

No branches or pull requests

3 participants