mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Box the cache for better performance
This commit is contained in:
parent
1722d61190
commit
d6828583d8
1 changed files with 5 additions and 5 deletions
|
@ -12,7 +12,7 @@ use collections::{hash_map, HashMap, HashSet};
|
||||||
use util::post_inc;
|
use util::post_inc;
|
||||||
|
|
||||||
pub struct InlayHintCache {
|
pub struct InlayHintCache {
|
||||||
snapshot: CacheSnapshot,
|
snapshot: Box<CacheSnapshot>,
|
||||||
update_tasks: HashMap<ExcerptId, InlayHintUpdateTask>,
|
update_tasks: HashMap<ExcerptId, InlayHintUpdateTask>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ struct ExcerptCachedHints {
|
||||||
pub struct HintsUpdateState {
|
pub struct HintsUpdateState {
|
||||||
multi_buffer_snapshot: MultiBufferSnapshot,
|
multi_buffer_snapshot: MultiBufferSnapshot,
|
||||||
visible_inlays: Vec<Inlay>,
|
visible_inlays: Vec<Inlay>,
|
||||||
cache: CacheSnapshot,
|
cache: Box<CacheSnapshot>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
|
@ -59,11 +59,11 @@ struct ExcerptHintsUpdate {
|
||||||
impl InlayHintCache {
|
impl InlayHintCache {
|
||||||
pub fn new(inlay_hint_settings: editor_settings::InlayHints) -> Self {
|
pub fn new(inlay_hint_settings: editor_settings::InlayHints) -> Self {
|
||||||
Self {
|
Self {
|
||||||
snapshot: CacheSnapshot {
|
snapshot: Box::new(CacheSnapshot {
|
||||||
allowed_hint_kinds: allowed_hint_types(inlay_hint_settings),
|
allowed_hint_kinds: allowed_hint_types(inlay_hint_settings),
|
||||||
hints: HashMap::default(),
|
hints: HashMap::default(),
|
||||||
version: 0,
|
version: 0,
|
||||||
},
|
}),
|
||||||
update_tasks: HashMap::default(),
|
update_tasks: HashMap::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ impl InlayHintCache {
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn snapshot(&self) -> CacheSnapshot {
|
fn snapshot(&self) -> Box<CacheSnapshot> {
|
||||||
self.snapshot.clone()
|
self.snapshot.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue