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 workspace" very slow #2628

Closed
princehektor opened this issue Oct 8, 2018 · 25 comments
Closed

"Go to symbol in workspace" very slow #2628

princehektor opened this issue Oct 8, 2018 · 25 comments

Comments

@princehektor
Copy link

princehektor commented Oct 8, 2018

Type: LanguageService

Describe the bug

  • OS and Version: Ubuntu 16.04, 64bit
  • VS Code Version: 1.27.2
  • C/C++ Extension Version: 0.19.0
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce

  1. 'Go to symbol in workspace' is very slow and doesn't support fuzzy search . This is in comparison to Sublime Text on the same project (I recently started using VS Code)

However 'Go to symbol in file' is super quick and does support fuzzy search.

Is there a way to extend this functionality to the 'Go to symbol in work space' as well ?

Expected behavior
'Go to symbol in work space' is fast and supports fuzzy search (like Sublime)

Screenshots

Additional context

@princehektor
Copy link
Author

@sean-mcmanus : Here you go.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Oct 9, 2018

What do you mean by "doesn't support fuzzy search"? Go to Symbol in workspace and file should be identical in respect to the fuzzyiness.

Also, is Go to Symbol in Workspace acceptably fast for you the 2nd time it is done, or is the problem just the 1st time it's run (which we do an expensive caching operation). We had a plan to do the expensive caching computation in the background after extension loading instead of on the 1st invocation of Go to Symbol in workspace.

@princehektor
Copy link
Author

princehektor commented Oct 9, 2018

Oh. Maybe i used the wrong term to describe my problem.

  1. When i try to search for a symbol in a given file, i start typing the word and VS code already starts showing all possible combinations of the word/symbol. It doesn't have to be the starting word of the symbol - it even works for a word that is part of the symbol(e.g. My_Function_Get()- i can search for either 'My' or 'Function' or 'Get)'

  2. When i try to search for the same symbol across the entire work space, i dont see VS code showing me any possible combinations or all symbols with that word in it. I have to type in the word and wait for 4-5 seconds to see the results. First time or second time, i same the same sluggishness.

I hope i was able to describe the issue that i am seeing.

@sean-mcmanus
Copy link
Contributor

I'm seeing the same fuzzy behavior with workspace symbols:

image

The most likely explanation is that your search string is hitting our limit of 1000 results, causing the fuzzy results your expecting to not appear.

It sounds like you're repeatedly seeing 4-5 seconds for workspace searching -- this not expected, unless possibly if your machine is unusually slow. I'm seeing < 2 seconds with 25k files, 200 MB database. Is there anything unsual about your scenario, such as remote file access? How big is your database file? You can easily see the size of it via setting the databaseFilename to something like "${workspaceFolder}/.vscode/vc.db".

@princehektor
Copy link
Author

I dont think its the '1000' results case since the symbol i am searching for only appears in about 10-15 places.

Also its not 4-5 seconds every time. Sometimes i see the results in around 2-3 seconds, but it doesn't start auto completing instantly like it does with "Go to symbol in file". I have to type the symbol and wait for a few seconds for the results to show up. Also i coming from Sublime Text, therefore i am trying to get the same functionality here. This is not a problem as such, just that it would be great if the search was faster.

Also,i created the database file but it looks like it is around 320 MB and my project has around 10000 files. Weird thing is that the size keeps increasing. The db file size started out at around 50 MB and progressively increased to around 320 MB. Is this expected ?

Also there is no remote file access going on here and my machine is not that slow , it is an i7 clocked at 3.6Ghz.

@sean-mcmanus
Copy link
Contributor

If the database size is still increasing (and there's a database icon in the bottom right) that means symbols are still being parsed in your workspace -- I don't see that causing additional slowness though.

The fast "auto complete" behavior is when the filtering is done by VS -- for Go to Symbol in File, we ignore the filter text and just send all the symbols in the doc, so the text that is added is filtered by VS Code (quickly). For workspace symbols, every text entered causes us to re-query the database, which is "slower".

@princehektor
Copy link
Author

The database file size is finally 387MB. Not increasing beyond that.

I understand your explanation about the "auto complete" option only being enabled for the "Go to symbol in file" and not the "Go to symbol in work space". Therefore it is slightly slower. Totally get it.

But i am going to ask anyway :)

Is there some way we can add the same auto complete functionality to the "Go to symbol in workspace" as well ? Some setting i can change to do that ?

@sean-mcmanus
Copy link
Contributor

We would have to query and send all the symbol in the workspace to VS Code, which would probably be too many. We need to improve our in-memory symbol caching/processing to give faster results.

@princehektor
Copy link
Author

Ah okay. I was hoping to get the same functionality that i had while using Sublime (on the same project/work-space)

No big deal. Hoping that you guys can add this in the future.

Thanks for your help.

@jtyoung
Copy link

jtyoung commented Oct 23, 2018

I have this exact same issue, having switched from Sublime to VS Code recently. Aside from being an order of magnitude slower than Sublime's symbol search, I've found it pretty difficult to work with in general.

It doesn't seem to begin searching until after I've stopped typing, which I think really contributes to the sluggish feel of the search.

Regarding fuzzy search, I routinely search symbols while excluding punctuation in names (specifically underscores). In the example above, searching "empty_range" is found, but "empty range" is not.

Another issue I have in my workspace is that I have many symbols that have identical names in many different files. Sublime, when it finds a name conflict, presents a list of the files it found matches in and lets the user choose which file they wanted. VS Code seems to pick a file at random and present that as the only option, leading me to have to cancel that search and do a file search instead to get to the file I wanted and THEN do a symbol search within that.

I like VS Code otherwise, and most of my office has switched over to it in the last few weeks so I want to stick with it. But symbol search is a big part of how I interact with my code and it's been a big hindrance in getting me want to use it.

@sean-mcmanus
Copy link
Contributor

@jtyoung The picking a file at random for symbol search sounds like a bug. Do you have any more repro info for that? We only show the files with definitions of the symbol and not all references. We're working on the Find All References feature currently. I usually use Go to Definition/Declaration or file search and not symbol search.

@jtyoung
Copy link

jtyoung commented Oct 24, 2018

@sean-mcmanus Sure. For example, I have a method called update_impact that I have multiple versions of. One lives in a "v2" folder, another lives in "v3". When I do a symbol search for "update_impact", VS Code only surfaces one or the other, not both. This has been a very prevalent issue for me specifically because I am upgrading some of our backend data stores and rewriting a lot of our logic from the v2 folder over to the v3 folder, while preserving the same names of methods. Conversely, for example, when I choose a "duplicate" symbol in Sublime, it brings up a list of the files it matched and I can choose from there what definition I intended to open.

It doesn't seem to prefer the one I had opened most recently, and it doesn't always choose v2 or always choose v3. I assume it's just surfacing the first one it finds.

I did update to the latest VS Code version yesterday after commenting here and file search (Quick Open) seems significantly faster for me now. I also specifically excluded symbols from Quick Open in the settings, since I exclusively use that for file search, which gave me a big bump in performance as well.

@sean-mcmanus
Copy link
Contributor

@jtyoung Are all the folder under the same workspace? If the files are outside of the workspace, they need to be #included by a file in the workspace in order for the symbols to be parsed. You can use "browse": { "limitSymbolsToIncludedHeaders": false } in c_cpp_properties.json to change this behavior. Another reason the symbols might be missing is if something in the file is causing the symbols to not be parsed. You can set C_Cpp.loggingLevel to "Debug" to see if there are errors in parsing the symbols in the a particular folder. Also, there's a bug in VS Code Insiders that is causing Go to Definition to only show 1 result instead of all of them, but it doens't affect Go to Symbols: microsoft/vscode#61654 .

image

@jtyoung
Copy link

jtyoung commented Oct 24, 2018

@sean-mcmanus They are indeed in the same workspace, but I just realized I'm commenting on the C++ tools repo. I followed a few other issues about symbol/file search that linked me here, assuming I was still in the general VS Code repo. I am using Python, so my issues are probably unrelated to anything here.

Sorry for the misunderstanding, thanks for the replies.

@hungys
Copy link

hungys commented Nov 3, 2018

+1

In a large project, I can not even get any result from "Go to symbol in workspace".

@AndreiD
Copy link

AndreiD commented Dec 26, 2018

it's slow as hell in Golang as well. anyone knows how to fix this

@sean-mcmanus
Copy link
Contributor

@AndreiD Our extension doesn't work with Golang, only C/C++.

@AndreiD
Copy link

AndreiD commented Dec 27, 2018 via email

@julian-poidevin
Copy link

@sean-mcmanus 👍 +1 : "Go to symbol in workspace" is unusable in large projects.

@rcdailey
Copy link

Been a while since there have been updates on this (over half a year). When can we expect this to be fixed?

My specific use case is that I have a C++ code base that uses CMake. Should there be some intellisense cache that VS Code creates when I open a folder? Shouldn't it scan and make all symbols quickly searchable when I open a folder? This is basically how Visual Studio IDE works right?

On a side note, why does the "Type to search for symbols" box disappear, effectively canceling the ongoing search operation, when I simply click to do work in another window while I wait for it to finish? That means I have to arbitrarily sit there and wait for it to finish instead of doing other things in parallel until I see results appear.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Aug 17, 2019

@rcdailey The work hasn't been scheduled.

We added Find All References (https://github.com/microsoft/vscode-cpptools/releases/tag/0.25.0-insiders2) -- that might give a better experience? It requires that all the files be configured correctly for IntelliSense though, unless the symbol search.

The "Type to search for symbols" UI behavior is controlled by VS. Find All References has a better progress UI with preview abilities. Maybe we could improve the symbol search somehow as well with a better progress indicator like we did for Find All References.

@wgqimut
Copy link

wgqimut commented Aug 26, 2019

@sean-mcmanus Actually "Go to symbol in workspace" fuzzy search is not good as "Go to file".

"Go to file" can do this:
image

"Go to symbol in workspace":
image
quotalink should have results like:
image

@sean-mcmanus
Copy link
Contributor

@wgqimut We're tracking fuzzy symbol search with #2751 .

@magdumnikhil
Copy link

We had a plan to do the expensive caching computation in the background after extension loading instead of on the 1st invocation of Go to Symbol in workspace.

I'm also facing the same problem. Would be glad to see this implemented.

@rcdailey
Copy link

rcdailey commented Jun 9, 2020

Why was this closed?

@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants