Raymond Toy pushed to branch issue-240-set-diff-with-hash-table at cmucl / cmucl
Commits:
-
b100ecd4
by Raymond Toy at 2023-07-27T17:59:17-07:00
1 changed file:
Changes:
... | ... | @@ -766,7 +766,11 @@ |
766 | 766 | (return-from list-to-hashtable nil))
|
767 | 767 | ;; If the list is too short, the hashtable makes things
|
768 | 768 | ;; slower. We also need to balance memory usage.
|
769 | - (let ((len (length list)))
|
|
769 | + (let ((len 0))
|
|
770 | + ;; Compute list length ourselves.
|
|
771 | + (dolist (item list)
|
|
772 | + (declare (ignore item))
|
|
773 | + (incf len))
|
|
770 | 774 | (when (< len *min-list-length-for-hashtable*)
|
771 | 775 | (return-from list-to-hashtable nil))
|
772 | 776 | (let ((hashtable (make-hash-table :test hash-test :size len)))
|