summaryrefslogtreecommitdiff
path: root/unix/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-09-23 10:50:43 +0100
committerDamien George <damien.p.george@gmail.com>2015-10-02 00:11:11 +0100
commit58e0f4ac50b3dc732cbfe0d7b04bb41951ac1329 (patch)
tree46b94d7f78766e545c0bbda3febeeaf6d7a4bec0 /unix/main.c
parente5635f4ab3d0fd00dd3951865fea82003205dae1 (diff)
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 'unix/main.c')
-rw-r--r--unix/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unix/main.c b/unix/main.c
index 3e4358672..7a2f7e4ff 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -108,15 +108,15 @@ STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind,
}
#endif
- mp_parse_node_t pn = mp_parse(lex, input_kind);
+ mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
/*
printf("----------------\n");
- mp_parse_node_print(pn, 0);
+ mp_parse_node_print(parse_tree.root, 0);
printf("----------------\n");
*/
- mp_obj_t module_fun = mp_compile(pn, source_name, emit_opt, is_repl);
+ mp_obj_t module_fun = mp_compile(&parse_tree, source_name, emit_opt, is_repl);
if (!compile_only) {
// execute it