gsoc: Loop invariant hoisting

[email protected] (Don Cohen) Sat, 23 Jun 2018 02:38:46 +0000
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
A possibly unintended consequence:

Here's an excerpt from a very old source file that I still use.

(compile (defun f(n stream)
 (loop for i below n do
  (setf (stream-element-type stream) '(unsigned-byte 8))
  (setf (stream-element-type stream) 'character))))
(time (f 100000 stream))
Real time: 1.487881 sec.
Run time: 1.47 sec.
Space: 2800000 Bytes
GC: 5, GC time: 0.09 sec.

Admittedly, that excerpt is in a comment, but the code and a whole
lot more very similar code has been run, and continues to be run 
in order to guide implementation and optimization decisions.

I suppose you could argue that such tests have always required the
programmer to be smarter than the compiler, but this has never 
been a serious issue - until NOW!

I'm reminded of the old star trek episode in which Mr Spock orders 
the computer to compute the exact value of PI, and imagining the
computer replying "I'm sorry Mr Spock, but you can't fool me with
that old trick..."

------------------------------------------------------------------------------
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