Improve prompt caching for edit prediction (#23061)

This is achieved by halving the number of events instead of popping the
front.

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Antonio Scandurra 2025-01-13 11:58:49 +01:00 committed by GitHub
parent e08484840b
commit f2ab00cec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -206,7 +206,7 @@ impl Zeta {
}
fn push_event(&mut self, event: Event) {
const MAX_EVENT_COUNT: usize = 20;
const MAX_EVENT_COUNT: usize = 16;
if let Some(Event::BufferChange {
new_snapshot: last_new_snapshot,
@ -232,8 +232,8 @@ impl Zeta {
}
self.events.push_back(event);
if self.events.len() > MAX_EVENT_COUNT {
self.events.pop_front();
if self.events.len() >= MAX_EVENT_COUNT {
self.events.drain(..MAX_EVENT_COUNT / 2);
}
}