mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Auto merge of #16335 - lnicola:salsa-lz4-file-text, r=Veykril
internal: Compress file text using LZ4 I haven't tested properly, but this roughly looks like: ``` 1246 MB 59mb 4899 FileTextQuery 1008 MB 20mb 4899 CompressedFileTextQuery 555kb 1790 FileTextQuery ``` We might want to test on something more interesting, like `bevy`.
This commit is contained in:
commit
8f8bcfc131
16 changed files with 89 additions and 36 deletions
|
@ -51,6 +51,7 @@ use std::{fmt, mem::ManuallyDrop};
|
|||
use base_db::{
|
||||
salsa::{self, Durability},
|
||||
AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast,
|
||||
DEFAULT_FILE_TEXT_LRU_CAP,
|
||||
};
|
||||
use hir::db::{DefDatabase, ExpandDatabase, HirDatabase};
|
||||
use triomphe::Arc;
|
||||
|
@ -157,6 +158,7 @@ impl RootDatabase {
|
|||
|
||||
pub fn update_base_query_lru_capacities(&mut self, lru_capacity: Option<usize>) {
|
||||
let lru_capacity = lru_capacity.unwrap_or(base_db::DEFAULT_PARSE_LRU_CAP);
|
||||
base_db::FileTextQuery.in_db_mut(self).set_lru_capacity(DEFAULT_FILE_TEXT_LRU_CAP);
|
||||
base_db::ParseQuery.in_db_mut(self).set_lru_capacity(lru_capacity);
|
||||
// macro expansions are usually rather small, so we can afford to keep more of them alive
|
||||
hir::db::ParseMacroExpansionQuery.in_db_mut(self).set_lru_capacity(4 * lru_capacity);
|
||||
|
@ -166,6 +168,7 @@ impl RootDatabase {
|
|||
pub fn update_lru_capacities(&mut self, lru_capacities: &FxHashMap<Box<str>, usize>) {
|
||||
use hir::db as hir_db;
|
||||
|
||||
base_db::FileTextQuery.in_db_mut(self).set_lru_capacity(DEFAULT_FILE_TEXT_LRU_CAP);
|
||||
base_db::ParseQuery.in_db_mut(self).set_lru_capacity(
|
||||
lru_capacities
|
||||
.get(stringify!(ParseQuery))
|
||||
|
@ -199,7 +202,7 @@ impl RootDatabase {
|
|||
// base_db::ProcMacrosQuery
|
||||
|
||||
// SourceDatabaseExt
|
||||
// base_db::FileTextQuery
|
||||
base_db::FileTextQuery
|
||||
// base_db::FileSourceRootQuery
|
||||
// base_db::SourceRootQuery
|
||||
base_db::SourceRootCratesQuery
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue