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

Go to Symbol in File... is extraordinarily slow. #1472

Closed
Zooce opened this issue Jan 19, 2018 · 13 comments
Closed

Go to Symbol in File... is extraordinarily slow. #1472

Zooce opened this issue Jan 19, 2018 · 13 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service performance quick fix
Milestone

Comments

@Zooce
Copy link

Zooce commented Jan 19, 2018

I'm coming from Sublime Text, so maybe I'm a bit spoiled in this regard, but one of the main features I use in Sublime Text is searching for symbols. VS Code has this feature, but for some reason it takes an extremely long time for any symbols to be found in my project. The project is massive, and some files can be quite large themselves, however this happens even with small files (e.g. < 400 lines) and seems like it should be a pretty standard procedure no matter the project size.

  • VSCode Version: 1.19.2
  • OS Version: Windows 7 x64
  • C/C++ Extension Version: 0.14.6

Steps to Reproduce:

  1. Open a .cpp file with function definitions inside (obviously don't open a blank .cpp file)
  2. Go > Go to Symbol in File...
  3. If it is the first time running this, no symbols will be found (esc. and try step 2 again)
  4. Wait for symbols to be parsed - it will sit there searching for a long time
@sean-mcmanus
Copy link
Contributor

I'm able to repro the issue. This problem has existed "forever". Our symbol search engine appears to be iterating over all symbols in the entire database, so the operation is linear in the size of your browse.path so most of the time it is just hitting symbols in different files. It's faster the 2nd time because it cashes the results.

@Zooce
Copy link
Author

Zooce commented Jan 19, 2018

So, the search doesn't understand the "in File..." part of "Go to Symbol." Thank you for looking into this, @sean-mcmanus.

@sean-mcmanus sean-mcmanus self-assigned this Jan 19, 2018
@sean-mcmanus sean-mcmanus added fixed Check the Milestone for the release in which the fix is or will be available. quick fix labels Jan 19, 2018
@sean-mcmanus sean-mcmanus added this to the February 2018 milestone Jan 19, 2018
@sean-mcmanus
Copy link
Contributor

We were actually computing the search results quickly for the specific file, but afterwards a 2nd workspace cache building operation was being done unnecessarily, blocking the results.

The search results (and all other operations) can still be blocked by the red flame if your translation unit takes too long to parse, but that's a different issue.

@sean-mcmanus
Copy link
Contributor

Fixed with the preview .vsix at https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders (our final release is planned for next week). Go to Symbol in Workspace can still be slow the 1st time due to the symbol cache generation and if you do a Go to Symbol in Workspace right before a Go to Symbol in File, it can block the "in File" results, because they're sent to the same processing queue.

@Zooce
Copy link
Author

Zooce commented Feb 5, 2018

Thanks, @sean-mcmanus! So far it's working like a charm. I really appreciate it.

@ababak
Copy link

ababak commented Jun 19, 2018

It's still extremely slow on Linux Version 1.24.1 + Python 2018.5.0 (05 Jun 2018)

@sean-mcmanus
Copy link
Contributor

@ababak Can you provide more repro info in a new bug? Go to Symbol in File should be really fast unless it's blocked by another operation (e.g. testing with Chromium on Linux). Is there a red flame in the bottom right? Did you do a Go to Symbol in Workspace?

@peterlevi
Copy link

I can confirm "Go to Symbol in File..." is most times very very slow on 1.24.1
(on Ubuntu 16.04) on a largish Python file (~1500 lines) - most times I'm just looking at the animated thingie. Second time it sometimes appears fast, next time it's slow again. Using it on this file: https://github.com/peterlevi/ojo/blob/master/ojo/ojo.py (vscode started directly in the root of that whole repo)

vscode_slow_goto_symbol

peter@plpc ~/dev/ojo (master) $ code --version
1.24.1
24f62626b222e9a8313213fb64b10d741a326288
x64

peter@plpc ~/dev/ojo (master) $ code --list-extensions --show-versions
eamodio.gitlens@8.4.1
k--kato.intellij-idea-keybindings@0.2.24
magicstack.MagicPython@1.0.12
ms-python.python@2018.6.0
rokoroku.vscode-theme-darcula@1.1.0

@sean-mcmanus
Copy link
Contributor

@peterlevi Could you file your issue with the python extension? This is the C/C++ extension.

@peterlevi
Copy link

Thank you, sorry for the confusion, filed here: microsoft/vscode-python#2050

@princehektor
Copy link

@sean-mcmanus : Was this issue fixed ?

I recently switched from Sublime to VS Code for C/C++ and one thing i noticed is that that "Go to Symbol in Workspace" is very slow. I enter the symbol that i am interested in and the results only show up after 4-5 seconds. My project is not super large. Maybe close to a 1000 files.

However" Go to Symbol in file" is super fast and also supports the fuzzy search.

Is there any way to speed up the "Go to Symbol in Workspace" and also add the fuzzy search functionality ?

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Oct 8, 2018

@princehektor This bug was about Go to Symbol in File and not Go to Symbol in Workspace. It looks like we don't have an issue tracking the slowness with Go to Symbol in Workspace (it's a known issue, but I can't locate it). I could create a new issue or you can if you want. Go to Symbol in Workspace should be fast if you only have 1000 files though, could be some other issue (but 4-5 seconds might be expected, or it's possible the request could be blocked by IntelliSense: #1928 ).

@princehektor
Copy link

@sean-mcmanus : Oh my bad. I did not know that this issue was tracking a different problem.

I created another issue for this - #2628

@sean-mcmanus sean-mcmanus removed their assignment Apr 22, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service performance quick fix
Projects
None yet
Development

No branches or pull requests

5 participants