perf(anim): reduce pointer dereferences

Christian Rocha created

Change summary

internal/tui/components/anim/anim.go | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Detailed changes

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
 		}
 	}
 }