summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-01-17 17:44:21 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-01-17 17:44:21 (GMT)
commit6b41c8f3db1778826ec8556f8900878a8f32c87a (patch)
tree8b65647a30cbf54f7a4bc314b4d4adcabda4701a /wasp/apps
parent5abae5a7f63f6841744ad63e7c8bbbb1d8452b37 (diff)
drivers: st7789: Pre-allocate a memoryview
Reduce the cost of slicing the linebuffer by pre-allocating a memoryview. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/gameoflife.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wasp/apps/gameoflife.py b/wasp/apps/gameoflife.py
index 109888c..7e2b518 100644
--- a/wasp/apps/gameoflife.py
+++ b/wasp/apps/gameoflife.py
@@ -223,7 +223,7 @@ class GameOfLifeApp():
display = wasp.watch.display
lb = display.linebuffer
- alive = memoryview(lb)[0:2*16]
+ alive = lb[0:2*16]
self._color = xorshift12(self._color)
rgbhi = get_color(self._color)
rgblo = rgbhi & 0xff
@@ -234,7 +234,7 @@ class GameOfLifeApp():
for i in (0, 3, 12, 15):
alive[i*2] = 0
alive[i*2+1] = 0
- dead = memoryview(lb)[2*16:4*16]
+ dead = lb[2*16:4*16]
for i in range(len(dead)):
dead[i] = 0