From: <don...@is...> - 2018-06-23 02:38:56
|
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..." |