summaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-18 06:55:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-18 06:55:31 -0700
commitea0fa417084012b1c44d3325e8fa0dbd47106952 (patch)
tree98110d9f402317eb7012315aa65a026cf5782a56 /vm.c
parent4a73b8e0cc47b93563c3f4ad935552adb2756411 (diff)
downloadtxr-ea0fa417084012b1c44d3325e8fa0dbd47106952.tar.gz
txr-ea0fa417084012b1c44d3325e8fa0dbd47106952.tar.bz2
txr-ea0fa417084012b1c44d3325e8fa0dbd47106952.zip
apply: eliminate wasteful consing.
Now (pprof (apply '+ 1 2 3 4 5 '(6 7))) shows zero bytes consed. Previously 176 (on 32 bit). This is the same whether the expression is compiled or interpreted. * eval.c (applyv): Rewritten to efficiently manipulate the args and call generic_funcall directly. The consing funcction apply_intrinsic_frob_args is only used when args contains a trailing list (args->list) and is only used on that trailing list, not the entire arg list. Also, changing the static function to external. * eval.h (applyv): Declared. * vm.c (vm_apply): Use applyv instead of wastefully converting the arguments to a consed list and going through apply_intrinsic.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 362f1adb..c0370343 100644
--- a/vm.c
+++ b/vm.c
@@ -464,7 +464,7 @@ static void vm_apply(struct vm *vm, vm_word_t insn)
}
}
- result = apply_intrinsic(vm_get(vm->dspl, fun), args_get_list(args));
+ result = applyv(vm_get(vm->dspl, fun), args);
vm_set(vm->dspl, dest, result);
}