Skip to content

Commit 53c5bde

Browse files
committed
core: Enable new performance optimizations
These two optional optimzations take a little codespace but improve bytecode performance: * micropython#7680 * micropython#7688
1 parent 7ea1919 commit 53c5bde

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

py/circuitpy_mpconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
#define MICROPY_NONSTANDARD_TYPECODES (0)
7878
#define MICROPY_OPT_COMPUTED_GOTO (1)
7979
#define MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE (CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)
80+
#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
81+
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE)
8082
#define MICROPY_PERSISTENT_CODE_LOAD (1)
8183

8284
#define MICROPY_PY_ARRAY (1)

py/circuitpy_mpconfig.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
145145
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0
146146
CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)
147147

148+
CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
149+
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
150+
151+
# This is disabled because it changes the bytecode format. We could choose to enable it
152+
# when we go to 8.x, but probably not for 7.1.
153+
CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE ?= 0
154+
CFLAGS += -DCIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE=$(CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE)
155+
ifeq ($(CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE),1)
156+
MPY_CROSS_FLAGS += -mcache-lookup-bc
157+
endif
158+
148159
CIRCUITPY_CONSOLE_UART ?= 0
149160
CFLAGS += -DCIRCUITPY_CONSOLE_UART=$(CIRCUITPY_CONSOLE_UART)
150161

0 commit comments

Comments
 (0)