From d9c8a934b5cdcef90bfc14149c85df5553e91218 Mon Sep 17 00:00:00 2001 From: phranck Date: Sun, 15 Feb 2026 02:35:26 +0100 Subject: [PATCH] Chore: Increase frame rate from ~35 FPS to ~42 FPS - Reduce run loop sleep from 28ms to ~24ms - Update notification and spinner timers to match --- Sources/TUIkit/App/App.swift | 6 +++--- Sources/TUIkit/Notification/NotificationHostModifier.swift | 2 +- Sources/TUIkit/Views/Spinner.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/TUIkit/App/App.swift b/Sources/TUIkit/App/App.swift index 684dbf9f..8400a2bb 100644 --- a/Sources/TUIkit/App/App.swift +++ b/Sources/TUIkit/App/App.swift @@ -187,10 +187,10 @@ extension AppRunner { eventsProcessed += 1 } - // Sleep 28ms to yield CPU. - // This sets the maximum frame rate to ~35 FPS. + // Sleep ~24ms to yield CPU. + // This sets the maximum frame rate to ~42 FPS. // - usleep(28_000) + usleep(23_800) } // Stop pulse timer before cleanup diff --git a/Sources/TUIkit/Notification/NotificationHostModifier.swift b/Sources/TUIkit/Notification/NotificationHostModifier.swift index 34c2fd7f..236e02d7 100644 --- a/Sources/TUIkit/Notification/NotificationHostModifier.swift +++ b/Sources/TUIkit/Notification/NotificationHostModifier.swift @@ -162,7 +162,7 @@ private extension NotificationHostModifier { .max() ?? 0 lifecycle.startTask(token: token, priority: .medium) { [lifecycle] in - let triggerNanos: UInt64 = 28_000_000 // 28ms (~35 FPS) + let triggerNanos: UInt64 = 23_800_000 // ~24ms (~42 FPS) while !Task.isCancelled { let now = Date().timeIntervalSinceReferenceDate diff --git a/Sources/TUIkit/Views/Spinner.swift b/Sources/TUIkit/Views/Spinner.swift index f33a51fa..cc55a72b 100644 --- a/Sources/TUIkit/Views/Spinner.swift +++ b/Sources/TUIkit/Views/Spinner.swift @@ -282,7 +282,7 @@ private struct _SpinnerCore: View, Renderable { if !lifecycle.hasAppeared(token: token) { _ = lifecycle.recordAppear(token: token) {} - let triggerNanos: UInt64 = 28_000_000 // 28ms — matches run loop poll rate (~35 FPS) + let triggerNanos: UInt64 = 23_800_000 // ~24ms — matches run loop poll rate (~42 FPS) lifecycle.startTask(token: token, priority: .medium) { while !Task.isCancelled { try? await Task.sleep(nanoseconds: triggerNanos)