Skip to content

Commit 7bd3ca1

Browse files
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.
1 parent a074e1a commit 7bd3ca1

File tree

1 file changed

+4
-0
lines changed
  • src/tools/rust-analyzer/crates/ide-db/src

1 file changed

+4
-0
lines changed

src/tools/rust-analyzer/crates/ide-db/src/search.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ impl<'a> FindUsages<'a> {
528528
search_scope: &SearchScope,
529529
name: &str,
530530
) -> bool {
531+
if self.scope.is_some() {
532+
return false;
533+
}
534+
531535
let _p = tracing::info_span!("short_associated_function_fast_search").entered();
532536

533537
let container = (|| {

0 commit comments

Comments
 (0)