Code search in Visual Studio 2022 is about to get much faster

Denizhan Y

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:

Gif showing the difference between Find in Files search in VS 2019 and VS 2022
Side-by-side video of VS 17.0 (left) and VS 17.1 Preview (right) searching about 50,000 files in 1,560 projects

How has Visual Studio 2022 Code Searching Improved Compared to Visual Studio 2019

Image FiF Graph

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

Comments are closed. Login to edit/delete your existing comments

  • Vincent Thorn

    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).

    • olivier-s

      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.

    • Jens Samson

      I use dumb search, because find references more than often is slow as molasses..
      I’d rather have them fix that.

    • Ian Marteens

      I’m with you. Indexing only adds more noise and less space.

  • olivier-s

    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!

    • Christian GundermanMicrosoft employee

      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.

  • 文龙 菅

    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.

  • Martin Kirk

    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

  • Simplex RPG Engine

    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?

  • Urs Meili

    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.

    • Paulo Pinto

      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.

      • Rolf Kristensen

        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.

      • Urs Meili

        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.

  • Sam Wheat

    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.

  • valii

    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

    • Josiah Bills

      I have the same issue. Is there a devcommunity feedback item tracking this that I can upvote?

      • Christian GundermanMicrosoft employee

        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.

      • Schmidt, Michel

        Late to the party, seeing this as well. There was a community issue filed, here.

  • Alain Robin

    Hello
    A speed comparison with vschromium would be interesting.
    Thanks.