summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-11-05 00:27:15 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-11-05 00:30:21 +0200
commit346aacf27f9bdfe8416efc30e2611f53dfc0cf5c (patch)
tree86445823ec1256bb601302ac7ddbc693fa5719ff /py
parentff8d0e071c4281e7593b4798e92af56bb80f5471 (diff)
unix: fast: Set initial module dict size big to have high pystone score.
For this, introduce MICROPY_MODULE_DICT_SIZE config setting.
Diffstat (limited to 'py')
-rw-r--r--py/mpconfig.h5
-rw-r--r--py/objmodule.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 6f92f3d88..8ef3e62fe 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -100,6 +100,11 @@
#define MICROPY_ALLOC_PATH_MAX (512)
#endif
+// Initial size of module dict
+#ifndef MICROPY_MODULE_DICT_SIZE
+#define MICROPY_MODULE_DICT_SIZE (1)
+#endif
+
/*****************************************************************************/
/* Micro Python emitters */
diff --git a/py/objmodule.c b/py/objmodule.c
index 01349c3d2..7f765ff95 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -96,7 +96,7 @@ mp_obj_t mp_obj_new_module(qstr module_name) {
mp_obj_module_t *o = m_new_obj(mp_obj_module_t);
o->base.type = &mp_type_module;
o->name = module_name;
- o->globals = mp_obj_new_dict(1);
+ o->globals = mp_obj_new_dict(MICROPY_MODULE_DICT_SIZE);
// store __name__ entry in the module
mp_obj_dict_store(o->globals, MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(module_name));