diff --git a/internal/tui/components/anim/anim.go b/internal/tui/components/anim/anim.go index 5cb9652e95d0bc3ddf40ab3d97db636a5f2ec1ff..63cb5d5a05a95a8768c22d3b2ac3cd887b63e694 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 // 8 FPS for better CPU efficiency + colorCycleFPS = time.Second / 3 // 3 FPS + maxCyclingChars = 60 // 60 characters ) var ( diff --git a/internal/tui/components/anim/anim_test.go b/internal/tui/components/anim/anim_test.go deleted file mode 100644 index 86d18ab4f2235775b69d22420966dad2e1193b86..0000000000000000000000000000000000000000 --- a/internal/tui/components/anim/anim_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package anim - -import ( - "testing" - "time" -) - -func BenchmarkAnimationUpdate(b *testing.B) { - anim := New(30, "Loading test data") - - b.ResetTimer() - for i := 0; i < b.N; i++ { - // Simulate character cycling update - _, _ = anim.Update(StepCharsMsg{id: anim.ID()}) - } -} - -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() - } -} - -func BenchmarkRandomRune(b *testing.B) { - c := cyclingChar{} - - b.ResetTimer() - for i := 0; i < b.N; i++ { - _ = c.randomRune() - } -} - -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)", - avgPerUpdate, iterations, duration) -}