diff options
author | Aleksey Kladov <[email protected]> | 2019-06-26 10:54:13 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-06-26 10:54:13 +0100 |
commit | a198d78bd1dafbfe78c597ff0deab17ac4d9092e (patch) | |
tree | cda79197641d6c78268d1badf2e52334abffa3c3 /crates/ra_hir/src/db.rs | |
parent | fc0f4ed6353174eb80229571e3e54993b1605e41 (diff) |
cache chalk queries
This gives a significant speedup, because chalk will call these
functions several times even withing a single revision. The only
significant one here is `impl_data`, but I figured it might be good to
cache others just for consistency.
The results I get are:
Before:
from scratch: 16.081457952s
no change: 15.846493ms
trivial change: 352.95592ms
comment change: 361.998408ms
const change: 457.629212ms
After:
from scratch: 14.910610278s
no change: 14.934647ms
trivial change: 85.633023ms
comment change: 96.433023ms
const change: 171.543296ms
Seems like a nice win!
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index d8832a9de..a9840905c 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -181,6 +181,26 @@ pub trait HirDatabase: DefDatabase + AstDatabase { | |||
181 | #[salsa::volatile] | 181 | #[salsa::volatile] |
182 | fn solver(&self, krate: Crate) -> Arc<Mutex<crate::ty::traits::Solver>>; | 182 | fn solver(&self, krate: Crate) -> Arc<Mutex<crate::ty::traits::Solver>>; |
183 | 183 | ||
184 | #[salsa::invoke(crate::ty::traits::chalk::associated_ty_data_query)] | ||
185 | fn associated_ty_data(&self, id: chalk_ir::TypeId) -> Arc<chalk_rust_ir::AssociatedTyDatum>; | ||
186 | |||
187 | #[salsa::invoke(crate::ty::traits::chalk::trait_datum_query)] | ||
188 | fn trait_datum( | ||
189 | &self, | ||
190 | krate: Crate, | ||
191 | trait_id: chalk_ir::TraitId, | ||
192 | ) -> Arc<chalk_rust_ir::TraitDatum>; | ||
193 | |||
194 | #[salsa::invoke(crate::ty::traits::chalk::struct_datum_query)] | ||
195 | fn struct_datum( | ||
196 | &self, | ||
197 | krate: Crate, | ||
198 | struct_id: chalk_ir::StructId, | ||
199 | ) -> Arc<chalk_rust_ir::StructDatum>; | ||
200 | |||
201 | #[salsa::invoke(crate::ty::traits::chalk::impl_datum_query)] | ||
202 | fn impl_datum(&self, krate: Crate, impl_id: chalk_ir::ImplId) -> Arc<chalk_rust_ir::ImplDatum>; | ||
203 | |||
184 | #[salsa::invoke(crate::ty::traits::implements_query)] | 204 | #[salsa::invoke(crate::ty::traits::implements_query)] |
185 | fn implements( | 205 | fn implements( |
186 | &self, | 206 | &self, |