summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Radvan <tim@tjvr.org>2021-04-03 12:20:48 +0100
committerDamien George <damien@micropython.org>2021-04-07 10:06:18 +1000
commit4f53f462ca9dbec45771e06d2d1a84b61e01e61a (patch)
tree7940b6ac6edc3684ea7c83d37f5c653508fe62cf
parent172fb5230a3943eeb6fbbb4de1dc56b16e2a7637 (diff)
rp2: Import uarray instead of array in rp2 module.
Some forum users noticed that `sm.exec()` took longer the more was present on the flash filesystem connected to the RP2040. They traced this back to the `array` import inside `asm_pio()`, which is causing MicroPython to scan the filesystem. uarray is a built-in module, so importing it shouldn't require scanning the filesystem. We avoid moving the import to the top-level in order to keep the namespace clean; we don't want to accidentally expose `rp2.array`.
-rw-r--r--ports/rp2/modules/rp2.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ports/rp2/modules/rp2.py b/ports/rp2/modules/rp2.py
index a3adcdc51..17e35c73b 100644
--- a/ports/rp2/modules/rp2.py
+++ b/ports/rp2/modules/rp2.py
@@ -33,7 +33,9 @@ class PIOASMEmit:
push_thresh=32,
pull_thresh=32
):
- from array import array
+ # uarray is a built-in module so importing it here won't require
+ # scanning the filesystem.
+ from uarray import array
self.labels = {}
execctrl = 0