From 4bbc385277bcab509c321b1374f72f1ef19d7750 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Jul 2020 10:14:48 +0200 Subject: Switch to fully dynamically dispatched salsa This improves compile times quite a bit --- crates/ra_ide/src/status.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 45411b357..08e6f69cb 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs @@ -2,10 +2,7 @@ use std::{fmt, iter::FromIterator, sync::Arc}; use hir::MacroFile; use ra_db::{ - salsa::{ - debug::{DebugQueryTable, TableEntry}, - Database, - }, + salsa::debug::{DebugQueryTable, TableEntry}, FileTextQuery, SourceRootId, }; use ra_ide_db::{ @@ -14,15 +11,15 @@ use ra_ide_db::{ }; use ra_prof::{memory_usage, Bytes}; use ra_syntax::{ast, Parse, SyntaxNode}; +use rustc_hash::FxHashMap; use crate::FileId; -use rustc_hash::FxHashMap; fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { - db.query(ra_db::ParseQuery).entries::() + ra_db::ParseQuery.in_db(db).entries::() } fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { - db.query(hir::db::ParseMacroQuery).entries::() + hir::db::ParseMacroQuery.in_db(db).entries::() } // Feature: Status @@ -35,10 +32,10 @@ fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { // | VS Code | **Rust Analyzer: Status** // |=== pub(crate) fn status(db: &RootDatabase) -> String { - let files_stats = db.query(FileTextQuery).entries::(); + let files_stats = FileTextQuery.in_db(db).entries::(); let syntax_tree_stats = syntax_tree_stats(db); let macro_syntax_tree_stats = macro_syntax_tree_stats(db); - let symbols_stats = db.query(LibrarySymbolsQuery).entries::(); + let symbols_stats = LibrarySymbolsQuery.in_db(db).entries::(); format!( "{}\n{}\n{}\n{} (macros)\n\n\nmemory:\n{}\ngc {:?} seconds ago", files_stats, -- cgit v1.2.3