From b98278307e4eec16593a1c718329dda8339b8654 Mon Sep 17 00:00:00 2001 From: Chayim Refael Friedman Date: Sun, 25 Aug 2024 04:35:58 +0300 Subject: [PATCH] Don't enable the search fast path for short associated functions when a search scope is set In most places where we set a search scope it is a single file, and so the fast path will actually harm performance, since it has to search for aliases in the whole project. The only exception that qualifies for the fast path is SSR (there is an exception that don't qualify for the fast path as it search for `use` items). It sets the search scope to avoid dependencies. We could make it use the fast path, but I didn't bother. --- crates/ide-db/src/search.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/ide-db/src/search.rs b/crates/ide-db/src/search.rs index c807a5940d..12ce5a403f 100644 --- a/crates/ide-db/src/search.rs +++ b/crates/ide-db/src/search.rs @@ -528,6 +528,10 @@ impl<'a> FindUsages<'a> { search_scope: &SearchScope, name: &str, ) -> bool { + if self.scope.is_some() { + return false; + } + let _p = tracing::info_span!("short_associated_function_fast_search").entered(); let container = (|| {