diff --git a/internal/tui/components/anim/anim.go b/internal/tui/components/anim/anim.go index 34f7a67e28f8b50d79d25f8cf766a7797e7d125d..5cb9652e95d0bc3ddf40ab3d97db636a5f2ec1ff 100644 --- a/internal/tui/components/anim/anim.go +++ b/internal/tui/components/anim/anim.go @@ -17,9 +17,9 @@ import ( ) const ( - charCyclingFPS = time.Second / 8 // Reduced from 22 to 8 FPS for better CPU efficiency - colorCycleFPS = time.Second / 3 // Reduced from 5 to 3 FPS - maxCyclingChars = 60 // Reduced from 120 to 60 characters + charCyclingFPS = time.Second / 8 // Reduced from 22 to 8 FPS for better CPU efficiency + colorCycleFPS = time.Second / 3 // Reduced from 5 to 3 FPS + maxCyclingChars = 60 // Reduced from 120 to 60 characters ) var ( diff --git a/internal/tui/components/anim/anim_test.go b/internal/tui/components/anim/anim_test.go index 264f5fd9f905cc90c52eedff5d470677fbf83c45..86d18ab4f2235775b69d22420966dad2e1193b86 100644 --- a/internal/tui/components/anim/anim_test.go +++ b/internal/tui/components/anim/anim_test.go @@ -7,7 +7,7 @@ import ( func BenchmarkAnimationUpdate(b *testing.B) { anim := New(30, "Loading test data") - + b.ResetTimer() for i := 0; i < b.N; i++ { // Simulate character cycling update @@ -17,12 +17,12 @@ func BenchmarkAnimationUpdate(b *testing.B) { func BenchmarkAnimationView(b *testing.B) { anim := New(30, "Loading test data") - + // Initialize with some cycling for i := 0; i < 10; i++ { anim.Update(StepCharsMsg{id: anim.ID()}) } - + b.ResetTimer() for i := 0; i < b.N; i++ { _ = anim.View() @@ -31,7 +31,7 @@ func BenchmarkAnimationView(b *testing.B) { func BenchmarkRandomRune(b *testing.B) { c := cyclingChar{} - + b.ResetTimer() for i := 0; i < b.N; i++ { _ = c.randomRune() @@ -40,24 +40,24 @@ func BenchmarkRandomRune(b *testing.B) { func TestAnimationPerformance(t *testing.T) { anim := New(30, "Performance test") - + start := time.Now() iterations := 1000 - + // Simulate rapid updates for i := 0; i < iterations; i++ { anim.Update(StepCharsMsg{id: anim.ID()}) _ = anim.View() } - + duration := time.Since(start) avgPerUpdate := duration / time.Duration(iterations) - + // Should complete 1000 updates in reasonable time if avgPerUpdate > time.Millisecond { t.Errorf("Animation update too slow: %v per update (should be < 1ms)", avgPerUpdate) } - - t.Logf("Animation performance: %v per update (%d updates in %v)", + + t.Logf("Animation performance: %v per update (%d updates in %v)", avgPerUpdate, iterations, duration) -} \ No newline at end of file +}