diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-18 06:55:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-18 06:55:31 -0700 |
commit | ea0fa417084012b1c44d3325e8fa0dbd47106952 (patch) | |
tree | 98110d9f402317eb7012315aa65a026cf5782a56 /vm.c | |
parent | 4a73b8e0cc47b93563c3f4ad935552adb2756411 (diff) | |
download | txr-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); } |