# KITT without arrays

**URL:** <https://forum.electromage.com/t/kitt-without-arrays/1219>\
**Category:** Patterns and Code\
**Created:** [May 6, 2021, 3:48am UTC](https://forum.electromage.com/t/kitt-without-arrays/1219 "2021-05-06T03:48:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [May 6, 2021, 12:01pm UTC](https://forum.electromage.com/t/kitt-without-arrays/1219/3 "2021-05-06T12:01:28Z")

</div>

Ok, golfed mapped arrayless version (with sliders and exports for exploration):

```
export var tailPct = .6 // length of the tail in 0..1
export var speed = .05
export var pct1
export var pct2

export function sliderTail (v) {
  tailPct = .6 + v/3;
}

export function sliderSpeed (v) {
  speed = v/10;
}

export function render2D(index,x,y) {
  pct1 = y/2 - time(speed)
  pct2 = -y/2 - time(speed)
  v = max (0,( tailPct - 1 + triangle(pct1) * square(pct1,.5) ) / tailPct )
    + max (0,( tailPct - 1 + triangle(pct2) * square(pct2,.5) ) / tailPct )
  hsv(0, 1, v * v * v)
}

```

that’s running at 69+ FPS on my v3 with a 16x16 matrix

to compare:  
Original KITT runs at 79 FPS  
[Mapped Array KITT](https://forum.electromage.com/t/how-would-you-make-a-2d-kitt/1153/13) runs at 80 FPS

So the array approach is _slightly_ faster… but… even changing it from `v*v*v` to `v*v` adds a frame or 2 back. But still, that’s only a 15% difference in speed. You’ve entirely eliminated any arrays, pure math/waves, so it’s a bit slower but uses MUCH less memory.

---

_[View the full topic](https://forum.electromage.com/t/kitt-without-arrays/1219)._
