From: Taylor R Campbell Date: Sun, 20 Dec 2009 07:59:55 +0000 (-0500) Subject: Tweak CUSTOM-TABLE-TYPE in hashtb.scm further. X-Git-Tag: 20100708-Gtk~196 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=db7145404fb77691265db76955811070a654257f;p=mit-scheme.git Tweak CUSTOM-TABLE-TYPE in hashtb.scm further. 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. --- diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index 816196018..cd02e9beb 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -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=?))))