From 750a25dda0eff6432afe9941b341b0ae3c466751 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 14 Dec 2011 18:46:50 +0000 Subject: [PATCH] Optimize out the extra PUSH_EMPTY/APPEND when evaluating a list. Reduces the number of instructions executed by about 25%. About a 3-5% improvement in overall runtime. [SVN r75938] --- src/engine/function.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/function.c b/src/engine/function.c index 7e7cd85ae..78d5f223c 100644 --- a/src/engine/function.c +++ b/src/engine/function.c @@ -2108,8 +2108,11 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location ) compile_emit( c, INSTR_PUSH_APPEND, 0 ); parse = parse->left; } - compile_parse( parse->left, c, RESULT_STACK ); - compile_emit( c, INSTR_PUSH_APPEND, 0 ); + if ( parse->left->type != PARSE_NULL ) + { + compile_parse( parse->left, c, RESULT_STACK ); + compile_emit( c, INSTR_PUSH_APPEND, 0 ); + } adjust_result( c, RESULT_STACK, result_location ); } else if ( parse->type == PARSE_EVAL )