perf(tui): render streaming token secara inkremental + kurangi redraw sia-sia
- fix(view): token streaming kini benar-benar tampil — sebelumnya cache display_lines tidak pernah di-rebuild saat pesan terakhir berubah (msg_count == cached_count), jadi teks AI streaming tidak pernah muncul sampai pesan baru/resize - perf(view): streaming kini hanya re-render pesan TERAKHIR (splice di batas cached_last_start) → O(konten baru) per token, bukan O(seluruh history); guard cached_last_len mencegah re-render pada frame spinner tanpa token baru - perf(run): skip chrono::Utc::now() + drain toasts saat tidak ada toast - perf(misc): drain_expired_toasts tidak lagi clone seluruh daftar toast - perf(view): render_toasts fast-path saat toasts kosong
This commit is contained in:
@@ -179,16 +179,9 @@ impl MiscState {
|
||||
self.toasts.push(toast);
|
||||
}
|
||||
|
||||
/// Remove and return all toasts whose lifetime has expired at `now_ms`.
|
||||
pub fn drain_expired_toasts(&mut self, now_ms: i64) -> Vec<Toast> {
|
||||
let expired: Vec<_> = self
|
||||
.toasts
|
||||
.iter()
|
||||
.filter(|t| t.expired(now_ms))
|
||||
.cloned()
|
||||
.collect();
|
||||
/// Remove all toasts whose lifetime has expired at `now_ms`.
|
||||
pub fn drain_expired_toasts(&mut self, now_ms: i64) {
|
||||
self.toasts.retain(|t| !t.expired(now_ms));
|
||||
expired
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user