From d6828583d825f75c03d0ce24957b830c91a109c5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 22 Jun 2023 01:28:55 +0300 Subject: [PATCH] Box the cache for better performance --- crates/editor/src/inlay_hint_cache.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs index f5a1309c75..0eb81aa644 100644 --- a/crates/editor/src/inlay_hint_cache.rs +++ b/crates/editor/src/inlay_hint_cache.rs @@ -12,7 +12,7 @@ use collections::{hash_map, HashMap, HashSet}; use util::post_inc; pub struct InlayHintCache { - snapshot: CacheSnapshot, + snapshot: Box, update_tasks: HashMap, } @@ -38,7 +38,7 @@ struct ExcerptCachedHints { pub struct HintsUpdateState { multi_buffer_snapshot: MultiBufferSnapshot, visible_inlays: Vec, - cache: CacheSnapshot, + cache: Box, } #[derive(Debug, Default)] @@ -59,11 +59,11 @@ struct ExcerptHintsUpdate { impl InlayHintCache { pub fn new(inlay_hint_settings: editor_settings::InlayHints) -> Self { Self { - snapshot: CacheSnapshot { + snapshot: Box::new(CacheSnapshot { allowed_hint_kinds: allowed_hint_types(inlay_hint_settings), hints: HashMap::default(), version: 0, - }, + }), update_tasks: HashMap::default(), } } @@ -157,7 +157,7 @@ impl InlayHintCache { .detach(); } - fn snapshot(&self) -> CacheSnapshot { + fn snapshot(&self) -> Box { self.snapshot.clone() }