Behold! Immediate single floats!

Posted on 2005-02-16 in Lisp
» 0 comments

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.

Next » ETOOMUCHC (2005-03-21)
Previous » sb-sprof improvements (2005-01-11)

Comments

Name
Message

As an antispam measure, you need to write a super-secret password below. Today's password is "xyzzy" (without the quotes).

Password

Formatting guidelines for comments: No tags, two newlines can be used for separating paragraphs, http://... is automatically turned into a link.