aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-21 18:00:59 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-21 18:00:59 +0300
commitbc410c4261f12377a2eb7ea08f4112a1a9574a77 (patch)
tree99fef6ff2406c9be4147e63b0145f89c612261ea /src/app
parentb1c9833b828d12e7e0196c5607ae63372998e25a (diff)
perf: reduce headless server render overhead
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs2
-rw-r--r--src/app/runtime.rs13
2 files changed, 12 insertions, 3 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index a598100a..a3094ed8 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -25,6 +25,8 @@ use std::time::{Duration, Instant};
const MIN_RENDER_INTERVAL: Duration = Duration::from_millis(16);
pub(crate) const ANIMATION_INTERVAL: Duration = Duration::from_millis(16);
+pub(crate) const HEADLESS_ANIMATION_INTERVAL: Duration = Duration::from_millis(128);
+pub(crate) const HEADLESS_ANIMATION_TICK_STEP: u32 = 8;
const RESIZE_POLL_INTERVAL: Duration = Duration::from_millis(100);
const GIT_REMOTE_STATUS_REFRESH_INTERVAL: Duration = Duration::from_millis(1500);
const AUTO_UPDATE_CHECK_INTERVAL: Duration = Duration::from_secs(30 * 60);
diff --git a/src/app/runtime.rs b/src/app/runtime.rs
index b6ad806b..739a3670 100644
--- a/src/app/runtime.rs
+++ b/src/app/runtime.rs
@@ -1,4 +1,4 @@
-use std::time::Instant;
+use std::time::{Duration, Instant};
use crossterm::terminal;
@@ -171,9 +171,16 @@ impl App {
}
pub(crate) fn sync_animation_timer(&mut self, now: Instant) {
+ self.sync_animation_timer_with_interval(now, ANIMATION_INTERVAL);
+ }
+
+ pub(crate) fn sync_headless_animation_timer(&mut self, now: Instant) {
+ self.sync_animation_timer_with_interval(now, crate::app::HEADLESS_ANIMATION_INTERVAL);
+ }
+
+ fn sync_animation_timer_with_interval(&mut self, now: Instant, interval: Duration) {
if self.agent_panel_has_animation() {
- self.next_animation_tick
- .get_or_insert(now + ANIMATION_INTERVAL);
+ self.next_animation_tick.get_or_insert(now + interval);
} else {
self.next_animation_tick = None;
}