Code search in Visual Studio 2022 is about to get much faster
Visual Studio 2022 Find in Files is already more than 2x faster for 95% of searches compared to Visual Studio 2019. We wanted to make code search even better. I am excited to announce that Visual Studio 2022 17.1 Preview 3 introduces indexed Find in Files to make your search experience even faster! To try out the performance improvements yourself, download Visual Studio 2022 Preview:
How has Visual Studio 2022 Code Searching Improved Compared to Visual Studio 2019
The above graph illustrates the major improvements we have seen in search performance for the 95th percentile of searches executed since Visual Studio 2019. We see that 95% of searches in 17.1 Preview 3 find all matches to a search query in just over 1 second! For many search scenarios, this search experience will now feel instantaneous…any developers dream.
How does 17.1 Preview 3’s indexed Find in Files work?
To make sure indexed searching is enabled, go to Tools > Options > Environment > Preview Features and verify that “Enable indexing for faster find experience” is checked!
From then on, at solution load or folder open, Visual Studio launches a satellite process ‘ServiceHub.IndexingService.exe’ and transmits a list of files to it to index. The indexer then scrapes through the files and constructs an index of all of the n-grams contained in each file.
When the user performs a ‘Find’, this index is used to prune files from the search so that it completes more quickly.
The indexing process avoids impacting solution load, build, and user activities by running at Below Normal operating system priority outside of the main Visual Studio process.
Try it out and share your feedback!
We would love to get your feedback on our updated search performance so please give it a try and let us know what you think! You can share any feedback via Developer Community to help us make Visual Studio better for you!
26 comments
Hello
A speed comparison with vschromium would be interesting.
Thanks.
Enabling the search indexing option on my solution with 20+ projects inside, made the search in files unworkable with the search never ending and finding nothing.
In fact what i noticed is that with every new update visual studio is getting slower and slower and not any faster as advertised
I have the same issue. Is there a devcommunity feedback item tracking this that I can upvote?
Late to the party, seeing this as well. There was a community issue filed, here.
Thank you for reporting this issue, can you please use the Help > Send Feedback > Report a Problem menu command to report this to Developer Community website. Doing so will send diagnostic information and logs that we can use to diagnose the issue.
Awesome that you have decided to return file-search-performance to its original state (Before VS2019)
https://developercommunity.visualstudio.com/content/problem/404959/search-in-vs2019-very-slow.html
Also hope that file-searches will be possible without having to wait for all solution-background-processing to be completed first.
As far as I know there is still no robust, working, markdown editor for VS. Mads wrote this one a while back but it badly needs attention – and has for a very long time. I would much rather have resources devoted to items like this versus racking up trophy points in a search tool that is already fast enough for the majority.
I agree that it would be great with a full markdown editing experience built into Visual Studio. In the meantime, you might be pleased to know that I’ve completely rewritten the markdown extension for VS 2022 and in the processed fixed most of the open issues with the old versions. Grab it here: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor2
Thanks Mads, that is great news! Do you plan to support md-template? I really need that for a static documentation site I maintain.
Have been blocked by this issue for a while.
Jetbrains Rider has always had “instant Find in Files” because everything is indexed… I’m often astonished on how much Visual Studio is behind it’s competitors feature-wise.
I am quite sure it still misses lot of stuff, specially when compared against Visual Studio Ultimate.
And then there are the basic things like no GPGPU debugging, no proper .NET / C++ debugging, UWP workflows,….
Funny how people think third parties can do better than those that actually own the platform.
Yes, some of the VS Ultimate things are not there, especially when it comes to UML diagrams. But most people don’t use it anyway, the same as GPGPU debugging, C++ debugging. And it has some unique advantages: First-Class typescript/angular support, which means you have just one IDE which can handle everything, all the keyboard shortcuts for refactorings etc. are exactly the same whether you work in C# or typescript. Angular support is much better than in any other IDE, including VS Code. And built-in database support – you don’t need clumsy and slow SSMS anymore, most db-related stuff things can just be done inside the IDE as well.
Pretty sure Jetbrains Resharper still exists, so they are probably doing something right, which is better than what Microsoft does. Still waiting for a good memory-profiler from Microsoft, than can handle more than simple hello-world-program.
Christian, could you please elaborate on:
“The indexer then scrapes through the files and constructs an index of all of the n-grams contained in each file.”
1) Is there some delimiter for n-grams (whitespace..) or are super long n-grams generated in case of big files (max n = text length)?
2) Which data structure is used to represent the index?
3) Is any kind of compression applied?
Awesome !!
While you are working on search.. please improve Regex search so that multiline works better.
\n doesn’t match newline in [] character clause.. why not ?
Doing ((\n|.)*) feels terrible for a regex geek like me
Thanks for this feedback Martin 🙂
Could you please suggest this feature here? This will help us look into such requests more carefully!
It is an excited improvement since I use find in files very often.
But adding an option “ignore results in the comments“, that do not show search result in comments, is much needed.
Thanks for the feedback! There is an existing suggestion ticket for this request: https://developercommunity.visualstudio.com/t/find-and-replace-add-options-to-exclude-lines-with/368691
Please do upvote this ticket so that we can take suggestions like this into consideration in the future!
Is the index on disk or in memory? I’ve found that search tools with index in memory are much faster than those that have it on disk, even with today’s fast SSDs. Though of course they lead to a sub-process using many GB of memory.
Anyway, can’t wait to try it out, thanks for doing this!
The actual index is stored on disk but served by a satellite process that does some in-memory caching. The end result is a bit more RAM usage but an overall faster experience, particularly after the first search.
I never experienced any “long delay” problem w searching in files. Are you sure it’s the place to spend resources?
Most used thing is “find references” or “find implementations”, dumb search is rarely used. At least by me.
And introducing index is ONE MORE rubbish, which will pollute my project folder (I suppose you save indexes together w project).
I’m with you. Indexing only adds more noise and less space.
I use dumb search, because find references more than often is slow as molasses..
I’d rather have them fix that.
Just because you don’t use it doesn’t mean no one does… I haven’t used “Find References” in years since it’s unusable on the ultra large code bases I work on. Been relying on third-party search tools since then, I’m glad we’re finally getting a better integrated indexed search.
Same experience here. The intellisense search cannot be always be trusted on large code-bases, so prefer file-search. But sometimes file-search-filters in Visual Studio can sometimes become skewed and returns no results, so even simple file-search is not enough:
https://developercommunity.visualstudio.com/t/vs2019-find-all-in-files-not-returning-any-results/578995
I’m with you, Olivier. The code I work on is so convoluted that I use the “find in files” function more often than not. I’ll take any speed improvement I can get.