summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-06-04 07:00:18 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-06-04 07:00:18 -0700
commit18f4676d93c4601f76f28470865c2ae589cee095 (patch)
tree6a67d06d25fcfb82df2f0029d763f95d1e775f7b /lisplib.c
parenta4e061cc3dfc7b4bfc93ef48386eecb9147a85c2 (diff)
downloadtxr-18f4676d93c4601f76f28470865c2ae589cee095.tar.gz
txr-18f4676d93c4601f76f28470865c2ae589cee095.tar.bz2
txr-18f4676d93c4601f76f28470865c2ae589cee095.zip
mapping: rewrite loop using seq_info and args.
* eval.c (map_common): Do not extract the arguments as a list. Do not produce a list of iterator objects. Instead, allocate an array of seq_iter_t objects on the stack using alloca, and use these for walking the input lists in parallel. Do not cons a list of the tuples coming from the lists, but rather store the tuples into a struct args, also on the stack, and invoke the function with that. Now, the only heap memory we allocate is the resulting list being accumulated. In the case of mapdo, no heap allocation takes place. However, if some of the inputs are hashes, then hash iterators get allocated in seq_iter_init. (mapcarv, mappendv, mapdov): Pass self argument to map_common, needed for seq_iter_init.
Diffstat (limited to 'lisplib.c')
0 files changed, 0 insertions, 0 deletions