vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

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

Open Zooce opened this issue 8 years ago • 13 comments

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

Zooce avatar Jan 19 '18 17:01 Zooce

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.

sean-mcmanus avatar Jan 19 '18 21:01 sean-mcmanus

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

Zooce avatar Jan 19 '18 21:01 Zooce

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 avatar Jan 19 '18 22:01 sean-mcmanus

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.

sean-mcmanus avatar Feb 05 '18 21:02 sean-mcmanus

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

Zooce avatar Feb 05 '18 22:02 Zooce

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

ababak avatar Jun 19 '18 09:06 ababak

@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?

sean-mcmanus avatar Jun 19 '18 20:06 sean-mcmanus

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
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

peterlevi avatar Jun 21 '18 22:06 peterlevi

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

sean-mcmanus avatar Jun 21 '18 23:06 sean-mcmanus

Thank you, sorry for the confusion, filed here: https://github.com/Microsoft/vscode-python/issues/2050

peterlevi avatar Jun 22 '18 16:06 peterlevi

@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 ?

princehektor avatar Oct 08 '18 23:10 princehektor

@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: https://github.com/Microsoft/vscode-cpptools/issues/1928 ).

sean-mcmanus avatar Oct 08 '18 23:10 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 - https://github.com/Microsoft/vscode-cpptools/issues/2628

princehektor avatar Oct 08 '18 23:10 princehektor