Comment 2 for bug 394206

Revision history for this message
petdog (petdog) wrote :

Using a better hash function along with linear probing instead of double hashing makes ssets as fast as bitvectors on anything I could measure, and should be faster on pathological cases; for example with this test by David Lichteblau on sbcl-devel

(defun make-test (n)
  (flet ((local (i)
    (intern (write-to-string i) :cl-user)))
    `(lambda (,(local 0))
       (let (,@(loop
     for i from 1 below n
     collect (local i)))
  ,@(loop
        for i from 0 below (1- n)
        collect `(setf ,(local (1+ i)) ,(local i)))
  ,(local (1- n))))))

(defun test (n)
  (time (compile nil (make-test n))))

I get (with bitvectors)

* (test 200)
Evaluation took:
  47.830 seconds of real time

(with ssets)

* (test 200)
Evaluation took:
  4.096 seconds of real time

Here's a patch, if anybody is interested. (I also removed double-hashing from globaldb.lisp, hopefully in a correct way)