From: <Joe...@t-...> - 2017-11-23 18:09:15
|
Hi, Sam Steingold wrote: >The fix for https://sourceforge.net/p/clisp/bugs/375/ >(https://sourceforge.net/p/clisp/clisp/ci/52d209b7d29ddf1125d2d89f4185c20c2f09da12/) >introduces an extra binding per init expression. >This results in an extra bytecode instruction in the preamble, e.g., for >(loop repeat 100 for a on b for x in y collect (list a x)): Next to a cost in bytecode, there's also a memory footprint. Given that clisp's compiler doesn't perform liveness analysis, (LET ((s b)) (LOOP/PROG/TAGBODY #)) means that the binding for s will remain on the stack (where the value of s is held) for the whole duration of the loop. CLISP doesn't notice that s is only used once, in the loop initialization code and never afterwards. This reminds me of the discussion of GC leaks in functional programming. Hence it would be best if (loop repeat 100 for a on b for x in y collect (list a x)) could expand to (let* ((a b) (list-x y)(x #)) (prog ...)) without much intermediates. Regards, Jörg |