Unnamed repository; edit this file 'description' to name the repository.
picker: Increase item limit for caching in last_picker to 1_000_000
This change updates the limit from 100_000 to 1_000_000. Realistic (but large) projects like Chromium and Firefox have these many files. Storing a PathBuf per file would mean tens or hundreds of megabytes of memory consumption, so 1_000_000 seems like a reasonable limit.
Michael Davis 4 months ago
parent 88ef6af · commit 0ada510
-rw-r--r--helix-term/src/ui/picker.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index ee4a163d..4f77f8b9 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -1048,23 +1048,23 @@ impl<I: 'static + Send + Sync, D: 'static + Send + Sync> Component for Picker<I,
let close_fn = |picker: &mut Self| {
// if the picker is very large don't store it as last_picker to avoid
// excessive memory consumption
- let callback: compositor::Callback = if picker.matcher.snapshot().item_count() > 100_000
- {
- Box::new(|compositor: &mut Compositor, _ctx| {
- // remove the layer
- compositor.pop();
- })
- } else {
- // stop streaming in new items in the background, really we should
- // be restarting the stream somehow once the picker gets
- // reopened instead (like for an FS crawl) that would also remove the
- // need for the special case above but that is pretty tricky
- picker.version.fetch_add(1, atomic::Ordering::Relaxed);
- Box::new(|compositor: &mut Compositor, _ctx| {
- // remove the layer
- compositor.last_picker = compositor.pop();
- })
- };
+ let callback: compositor::Callback =
+ if picker.matcher.snapshot().item_count() > 1_000_000 {
+ Box::new(|compositor: &mut Compositor, _ctx| {
+ // remove the layer
+ compositor.pop();
+ })
+ } else {
+ // stop streaming in new items in the background, really we should
+ // be restarting the stream somehow once the picker gets
+ // reopened instead (like for an FS crawl) that would also remove the
+ // need for the special case above but that is pretty tricky
+ picker.version.fetch_add(1, atomic::Ordering::Relaxed);
+ Box::new(|compositor: &mut Compositor, _ctx| {
+ // remove the layer
+ compositor.last_picker = compositor.pop();
+ })
+ };
EventResult::Consumed(Some(callback))
};