py/runtime: Make sys.modules preallocate to a configurable size.
This allows configuring the pre-allocated size of sys.modules dict, in order to prevent unwanted reallocations at run-time (3 sys-modules is really not quite enough for a larger project).
This commit is contained in:
@@ -91,7 +91,7 @@ void mp_init(void) {
|
||||
#endif
|
||||
|
||||
// init global module dict
|
||||
mp_obj_dict_init(&MP_STATE_VM(mp_loaded_modules_dict), 3);
|
||||
mp_obj_dict_init(&MP_STATE_VM(mp_loaded_modules_dict), MICROPY_LOADED_MODULES_DICT_SIZE);
|
||||
|
||||
// initialise the __main__ module
|
||||
mp_obj_dict_init(&MP_STATE_VM(dict_main), 1);
|
||||
|
||||
Reference in New Issue
Block a user