From c519c8ed1071f3b209eef4e95d2291c44386ff57 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sat, 7 Jun 2025 08:57:53 -0400 Subject: [PATCH] perf(anim): reduce pointer dereferences --- internal/tui/components/anim/anim.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/tui/components/anim/anim.go b/internal/tui/components/anim/anim.go index 016165313008e5d46875de3f02a9ea0dde016894..3a7b615f6b09a7b8c3a6fac5909cccc6eccb4bb3 100644 --- a/internal/tui/components/anim/anim.go +++ b/internal/tui/components/anim/anim.go @@ -226,14 +226,15 @@ func (a anim) ID() string { } func (a *anim) updateChars(chars *[]cyclingChar) { - for i, c := range *chars { + charSlice := *chars // dereference to avoid repeated pointer access + for i, c := range charSlice { switch c.state(a.start) { case charInitialState: - (*chars)[i].currentValue = '.' + charSlice[i].currentValue = '.' case charCyclingState: - (*chars)[i].currentValue = c.randomRune() + charSlice[i].currentValue = c.randomRune() case charEndOfLifeState: - (*chars)[i].currentValue = c.finalValue + charSlice[i].currentValue = c.finalValue } } }