Tweak CUSTOM-TABLE-TYPE in hashtb.scm further.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 20 Dec 2009 07:59:55 +0000 (02:59 -0500)
committerTaylor R Campbell <campbell@mumble.net>
Sun, 20 Dec 2009 07:59:55 +0000 (02:59 -0500)
Use existing names for table types where possible, rather than
repeating the calls to MAKE-*-TYPE.

Reduces the size of hashtb.{bin,com,bci} by 10-12% on i386, and
probably measurably reduces the time to compile them too.

src/runtime/hashtb.scm

index 81619601838d0c6e5a805cea308ca1a2af28c010..cd02e9beb31210040a53de95dfa023ffa2eac037 100644 (file)
@@ -776,23 +776,32 @@ USA.
   (cond ((and (eq? key=? eq?)
              (or (eq? key-hash eq-hash-mod)
                  (eq? key-hash hash-by-identity)))
-        (make-strong-rehash-type eq-hash-mod eq?))
+        strong-eq-hash-table-type)
        ((and (eq? key=? eqv?)
              (eq? key-hash eqv-hash-mod))
-        (make-strong-rehash-type eqv-hash-mod eqv?))
+        strong-eqv-hash-table-type)
        ((and (eq? key=? equal?)
              (or (eq? key-hash equal-hash-mod)
                  (eq? key-hash hash)))
-        (make-strong-rehash-type equal-hash-mod equal?))
+        equal-hash-table-type)
+       ((and (eq? key=? string=?)
+             (or (eq? key-hash string-hash-mod)
+                 (eq? key-hash string-hash)
+                 (eq? key-hash hash)))
+        string-hash-table-type)
        ((and (or (eq? key=? string=?)
                  (eq? key=? string-ci=?))
              (or (eq? key-hash string-hash-mod)
                  (eq? key-hash string-hash)
+                 (eq? key-hash hash)
                  (eq? key-hash string-ci-hash)))
-        (make-strong-no-rehash-type (if (eq? key-hash string-hash)
-                                        string-hash-mod
-                                        key-hash)
-                                    key=?))
+        ;; This LET avoids copying the IF in the integrated body of
+        ;; MAKE-STRONG-NO-REHASH-TYPE, which does no good.
+        (let ((key-hash
+               (if (eq? key-hash string-hash)
+                   string-hash-mod
+                   key-hash)))
+          (make-strong-no-rehash-type key-hash key=?)))
        (else
         (make-strong-rehash-type key-hash key=?))))