From 7a59ebda66ac29702b8f83238eb350ce09269fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Sun, 16 Aug 2015 18:28:49 +0200 Subject: [PATCH] c_leta: don't compute whole list length for optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is interpreter performance tweak. Behavior stays the same. Signed-off-by: Daniel KochmaƄski --- src/c/compiler.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c/compiler.d b/src/c/compiler.d index ff76d899f..31c3d9122 100644 --- a/src/c/compiler.d +++ b/src/c/compiler.d @@ -1551,10 +1551,10 @@ c_let_leta(cl_env_ptr env, int op, cl_object args, int flags) { specials = env->values[3]; /* Optimize some common cases */ - switch(ecl_length(bindings)) { - case 0: return c_locally(env, CDR(args), flags); - case 1: op = OP_BIND; break; - } + if (bindings == ECL_NIL) + return c_locally(env, CDR(args), flags); + if (ECL_CONS_CDR(bindings) == ECL_NIL) + op = OP_BIND; for (vars=ECL_NIL, l=bindings; !Null(l); ) { cl_object aux = pop(&l);