diff options
author | Damien George <damien.p.george@gmail.com> | 2015-09-23 10:50:43 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-02 00:11:11 +0100 |
commit | 58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329 (patch) | |
tree | 46b94d7f78766e545c0bbda3febeeaf6d7a4bec0 /py/mpconfig.h | |
parent | e5635f4ab3d0fd00dd3951865fea82003205dae1 (diff) | |
download | micropython-58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329.tar.gz micropython-58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329.zip |
py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.
With this patch parse nodes are allocated sequentially in chunks. This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.
Saves roughly 20% of RAM during parse stage.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r-- | py/mpconfig.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 57fc227abb..99bf47536d 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -118,6 +118,12 @@ #define MICROPY_ALLOC_PARSE_INTERN_STRING_LEN (10) #endif +// Number of bytes to allocate initially when creating new chunks to store +// parse nodes. Small leads to fragmentation, large leads to excess use. +#ifndef MICROPY_ALLOC_PARSE_CHUNK_INIT +#define MICROPY_ALLOC_PARSE_CHUNK_INIT (128) +#endif + // Initial amount for ids in a scope #ifndef MICROPY_ALLOC_SCOPE_ID_INIT #define MICROPY_ALLOC_SCOPE_ID_INIT (4) |