master: Improve the early return from SSET-DELETE and -MEMBER

snuglas via Sbcl-commits <[email protected]> Mon, 20 Jul 2026 13:20:00 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  a7e50f3c4a2a6048bf042c0aad14af3843e4a810 (commit)
      from  f55213a95b1f5f36faba9ce4379823e331f0d84d (commit)

- Log -----------------------------------------------------------------
commit a7e50f3c4a2a6048bf042c0aad14af3843e4a810
Author: Douglas Katzman <[email protected]>
Date:   Mon Jul 20 12:07:47 2026 +0000

    Improve the early return from SSET-DELETE and -MEMBER
---
 src/compiler/sset.lisp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/sset.lisp b/src/compiler/sset.lisp
index 228aa5fbc..31b927ed1 100644
--- a/src/compiler/sset.lisp
+++ b/src/compiler/sset.lisp
@@ -103,9 +103,9 @@
 ;;; then return true, otherwise return false.
 (declaim (ftype (sfunction (sset-element sset) boolean) sset-delete))
 (defun sset-delete (element set)
+  (when (zerop (sset-count set))
+    (return-from sset-delete nil))
   (let ((vector (sset-vector set)))
-    (when (zerop (length vector))
-      (return-from sset-delete nil))
     (loop with mask of-type index = (1- (length vector))
           for hash of-type index = (logand mask (sset-hash element)) then
             (logand mask (1+ hash))
@@ -134,7 +134,7 @@
 ;;; Return true if ELEMENT is in SET, false otherwise.
 (declaim (ftype (sfunction (sset-element sset) boolean) sset-member))
 (defun sset-member (element set)
-  (when (zerop (length (sset-vector set)))
+  (when (zerop (sset-count set))
     (return-from sset-member nil))
   (loop with vector = (sset-vector set)
         with mask fixnum = (1- (length vector))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL