Posted on 2005-02-16 in Lisp
I just hacked an immediate single float presentation for 64-bit SBCL.
CL-USER> (defun foo (x)
(declare (single-float x))
(* 20 x))
FOO
CL-USER> (defun bar ()
(dotimes (i 10000)
(let ((x 40))
(dotimes (i 32)
(setf x (foo x))))))
BAR
Vanilla 64-bit SBCL:
CL-USER> (time (bar))
Evaluation took:
0017 seconds of real time
0012998 seconds of user run time
0004 seconds of system run time
0 page faults and
5,116,048 bytes consed
With immediate single floats:
CL-USER> (time (bar))
Evaluation took:
-0006 seconds of real time
-0004999 seconds of user run time
00 seconds of system run time
0 page faults and
0 bytes consed
Please ignore the negative runtimes and concentrate instead on the amount of bytes consed (I think there's a small bug in the new MOVE-FROM-SINGLE that can result in the sign bit flipping to negative randomly). Close enough for a proof of concept.