summaryrefslogtreecommitdiffstatshomepage
path: root/tools/mpy_ld.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-08-18 14:52:48 +1000
committerDamien George <damien@micropython.org>2021-09-16 16:02:19 +1000
commit11ef8f22fe7701cc75b6aaf2386670891eaacf92 (patch)
tree36b8e76771c83b5719ab2a4899c8db29fa02772f /tools/mpy_ld.py
parent7b89ad8dbf432ab51eea6d138e179bf51394c786 (diff)
downloadmicropython-11ef8f22fe7701cc75b6aaf2386670891eaacf92.tar.gz
micropython-11ef8f22fe7701cc75b6aaf2386670891eaacf92.zip
py/map: Add an optional cache of (map+index) to speed up map lookups.
The existing inline bytecode caching optimisation, selected by MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, reserves an extra byte in the bytecode after certain opcodes, which at runtime stores a map index of the likely location of this field when looking up the qstr. This scheme is incompatible with bytecode-in-ROM, and doesn't work with native generated code. It also stores bytecode in .mpy files which is of a different format to when the feature is disabled, making generation of .mpy files more complex. This commit provides an alternative optimisation via an approach that adds a global cache for map offsets, then all mp_map_lookup operations use it. It's less precise than bytecode caching, but allows the cache to be independent and external to the bytecode that is executing. It also works for the native emitter and adds a similar performance boost on top of the gain already provided by the native emitter. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tools/mpy_ld.py')
0 files changed, 0 insertions, 0 deletions