on main help sign in
fix: anim fmt files
commit69b649df37f2af634ec41d1bc49bef324fa30103 authorRaphael Amorim <rapha850@gmail.com> dateMon 16 Jun 2025, 15:55 (1 year ago) parentb7296ea
2 files changed+14−14
internal/tui/components/anim/anim.go+3−3 internal/tui/components/anim/anim_test.go+11−11
internal/tui/components/anim/anim.go+3−3
@@ -17,9 +17,9 @@ import (
1717)
1818
1919const (
20− charCyclingFPS = time.Second / 8 // Reduced from 22 to 8 FPS for better CPU efficiency
21− colorCycleFPS = time.Second / 3 // Reduced from 5 to 3 FPS
22− maxCyclingChars = 60 // Reduced from 120 to 60 characters
20+ charCyclingFPS = time.Second / 8 // Reduced from 22 to 8 FPS for better CPU efficiency
21+ colorCycleFPS = time.Second / 3 // Reduced from 5 to 3 FPS
22+ maxCyclingChars = 60 // Reduced from 120 to 60 characters
2323)
2424
2525var (
internal/tui/components/anim/anim_test.go+11−11
@@ -7,7 +7,7 @@ import (
77
88func BenchmarkAnimationUpdate(b *testing.B) {
99 anim := New(30, "Loading test data")
10−
10+
1111 b.ResetTimer()
1212 for i := 0; i < b.N; i++ {
1313 // Simulate character cycling update
@@ -17,12 +17,12 @@ func BenchmarkAnimationUpdate(b *testing.B) {
1717
1818func BenchmarkAnimationView(b *testing.B) {
1919 anim := New(30, "Loading test data")
20−
20+
2121 // Initialize with some cycling
2222 for i := 0; i < 10; i++ {
2323 anim.Update(StepCharsMsg{id: anim.ID()})
2424 }
25−
25+
2626 b.ResetTimer()
2727 for i := 0; i < b.N; i++ {
2828 _ = anim.View()
@@ -31,7 +31,7 @@ func BenchmarkAnimationView(b *testing.B) {
3131
3232func BenchmarkRandomRune(b *testing.B) {
3333 c := cyclingChar{}
34−
34+
3535 b.ResetTimer()
3636 for i := 0; i < b.N; i++ {
3737 _ = c.randomRune()
@@ -40,24 +40,24 @@ func BenchmarkRandomRune(b *testing.B) {
4040
4141func TestAnimationPerformance(t *testing.T) {
4242 anim := New(30, "Performance test")
43−
43+
4444 start := time.Now()
4545 iterations := 1000
46−
46+
4747 // Simulate rapid updates
4848 for i := 0; i < iterations; i++ {
4949 anim.Update(StepCharsMsg{id: anim.ID()})
5050 _ = anim.View()
5151 }
52−
52+
5353 duration := time.Since(start)
5454 avgPerUpdate := duration / time.Duration(iterations)
55−
55+
5656 // Should complete 1000 updates in reasonable time
5757 if avgPerUpdate > time.Millisecond {
5858 t.Errorf("Animation update too slow: %v per update (should be < 1ms)", avgPerUpdate)
5959 }
60−
61− t.Logf("Animation performance: %v per update (%d updates in %v)",
60+
61+ t.Logf("Animation performance: %v per update (%d updates in %v)",
6262 avgPerUpdate, iterations, duration)
63−}
63+}