mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user