Re: 1 extra bytecode instruction per variable per loop

<[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <f945afedcedb40f0926c4a930f1d8d29@HE105658.emea1.cds.t-internal.com>
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.