Hello,
I wanted to ask whether SBCL is able to determine side-effect free-ness
on a per-block basis. For example in:
(defun foo ()
(declare (optimize (speed 3) (safety 0)))
(loop for x from 0 to 1000000000 sum x)
nil)
The loop expands of course to something like `(block nil ...)`. If you
disassemble that function you can still see the loop and therefore the
function runs rather slow.
Unless I am unaware of some common lisp implicit behavior, I would
argue, that this function and the block, that the loop expands to,
cannot produce side effects and therefore will always return nil. Would
it be correct of me to assume, that the compiler could have optimized
the block away?
I don't ask because I think code like this gets written by hand very
often. But through macro expansion, I could imagine some of the
generated blocks are not always being used. Could this be an
optimization opportunity?
Thank you,
Daniel
_______________________________________________
Sbcl-help mailing list
Sbcl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help