summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-02-27 00:10:04 +1100
committerDamien George <damien.p.george@gmail.com>2019-03-01 15:22:46 +1100
commit0779693c23fcc55993a06e4e0adf30a3d41f90f5 (patch)
tree7f80921f2b287bad50173f031a611b323fdab78c /py/mpconfig.h
parent8ce22662feadeb6b564f1087134346cb287251f0 (diff)
py/compile: Add optimisation to compile OrderedDict inplace.
This optimisation eliminates the need to create a temporary normal dict. The optimisation is enabled via MICROPY_COMP_CONST_LITERAL which is enabled by default (although only has an effect if OrderdDict is enabled). Thanks to @pfalcon for the initial idea and implementation.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 47638fb0a..c4b62dd84 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -356,6 +356,11 @@
#define MICROPY_COMP_CONST_FOLDING (1)
#endif
+// Whether to enable optimisations for constant literals, eg OrderedDict
+#ifndef MICROPY_COMP_CONST_LITERAL
+#define MICROPY_COMP_CONST_LITERAL (1)
+#endif
+
// Whether to enable lookup of constants in modules; eg module.CONST
#ifndef MICROPY_COMP_MODULE_CONST
#define MICROPY_COMP_MODULE_CONST (0)