Skip to content

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

Closed

Description

@Zooce

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

Activity

  1. sean-mcmanus commented on Jan 19, 2018

    @sean-mcmanus
    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.

  2. Zooce commented on Jan 19, 2018

    @Zooce
    Author

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

  3. sean-mcmanus commented on Jan 19, 2018

    @sean-mcmanus
    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.

  4. sean-mcmanus commented on Feb 5, 2018

    @sean-mcmanus
    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.

  5. Zooce commented on Feb 5, 2018

    @Zooce
    Author

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

  6. ababak commented on Jun 19, 2018

    @ababak

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

  7. sean-mcmanus commented on Jun 19, 2018

    @sean-mcmanus
    Contributor

    Andriy Babak (@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?

  8. peterlevi commented on Jun 21, 2018

    @peterlevi

    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
    
  9. sean-mcmanus commented on Jun 21, 2018

    @sean-mcmanus
    Contributor

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

  10. peterlevi commented on Jun 22, 2018

    @peterlevi

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

  11. princehektor commented on Oct 8, 2018

    @princehektor

    Sean McManus (@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 ?

  12. sean-mcmanus commented on Oct 8, 2018

    @sean-mcmanus
    Contributor

    amadhus (@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 ).

  13. princehektor commented on Oct 8, 2018

    @princehektor

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

    I created another issue for this - #2628

  14. locked and limited conversation to collaborators on Oct 15, 2020
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions