Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl
Commits:
-
c09004a1
by Raymond Toy at 2023-07-26T14:34:09-07:00
1 changed file:
Changes:
... | ... | @@ -744,8 +744,9 @@ |
744 | 744 | list
|
745 | 745 | (cons item list)))
|
746 | 746 | |
747 | -;; The minimum length of a list before we can use a hashtable
|
|
748 | -(defparameter *min-list-length-for-hashtable*
|
|
747 | +;; The minimum length of a list before we can use a hashtable. This
|
|
748 | +;; was determined experimentally.
|
|
749 | +(defconstant +min-list-length-for-hashtable+
|
|
749 | 750 | 15)
|
750 | 751 | |
751 | 752 | ;; Convert a list to a hashtable. The hashtable does not handle
|
... | ... | @@ -763,7 +764,7 @@ |
763 | 764 | ;; If the list is too short, the hashtable makes things
|
764 | 765 | ;; slower. We also need to balance memory usage.
|
765 | 766 | (let ((len (length list)))
|
766 | - (when (< len *min-list-length-for-hashtable*)
|
|
767 | + (when (< len +min-list-length-for-hashtable+)
|
|
767 | 768 | (return-from list-to-hashtable nil))
|
768 | 769 | (let ((hashtable (make-hash-table :test hash-test :size len)))
|
769 | 770 | (dolist (item list)
|