Skip to content

Commit

Permalink
core: Enable new performance optimizations
Browse files Browse the repository at this point in the history
These two optional optimzations take a little codespace but improve
bytecode performance:
 * micropython#7680
 * micropython#7688
  • Loading branch information
jepler committed Oct 15, 2021
1 parent 7ea1919 commit 53c5bde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions py/circuitpy_mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
#define MICROPY_NONSTANDARD_TYPECODES (0)
#define MICROPY_OPT_COMPUTED_GOTO (1)
#define MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE (CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)
#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE)
#define MICROPY_PERSISTENT_CODE_LOAD (1)

#define MICROPY_PY_ARRAY (1)
Expand Down
11 changes: 11 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0
CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE)

CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1
CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH)

# This is disabled because it changes the bytecode format. We could choose to enable it
# when we go to 8.x, but probably not for 7.1.
CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE ?= 0
CFLAGS += -DCIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE=$(CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE)
ifeq ($(CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE),1)
MPY_CROSS_FLAGS += -mcache-lookup-bc
endif

CIRCUITPY_CONSOLE_UART ?= 0
CFLAGS += -DCIRCUITPY_CONSOLE_UART=$(CIRCUITPY_CONSOLE_UART)

Expand Down

0 comments on commit 53c5bde

Please sign in to comment.