mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 14:20:35 +00:00
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:
parent
e08484840b
commit
f2ab00cec7
1 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue