master: Grow consets more lazily
snuglas via Sbcl-commits <[email protected]> Tue, 28 Jul 2026 15:37:01 +0000
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via b576ceb33fcf805b46f6bd0d6eb5794aebb1a0f4 (commit)
from 10d014d56bbb626b3bfcfcc443d54ae0c3f3823b (commit)
- Log -----------------------------------------------------------------
commit b576ceb33fcf805b46f6bd0d6eb5794aebb1a0f4
Author: Douglas Katzman <[email protected]>
Date: Tue Jul 28 15:24:31 2026 +0000
Grow consets more lazily
Start at 0 size because at least 10% of all CONSETs never get an element
inserted. And power-of-2 growth is too aggressive; the nearest dualword
works fine. About 75% of all consets have fewer than 3 dualwords.
This of course varies depending on the files being compiled, but held
true for self-build as well as many other things.
---
src/compiler/constraint.lisp | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/compiler/constraint.lisp b/src/compiler/constraint.lisp
index 3526e3fff..f506c70fe 100644
--- a/src/compiler/constraint.lisp
+++ b/src/compiler/constraint.lisp
@@ -194,10 +194,7 @@
(defstruct (conset
(:constructor make-conset ())
(:copier %copy-conset))
- (vector (make-array
- (power-of-two-ceiling (length *constraint-universe*))
- :element-type 'bit :initial-element 0)
- :type simple-bit-vector)
+ (vector #* :type simple-bit-vector)
;; Bit-vectors win over lightweight hashes for copy, union,
;; intersection, difference, but lose for iteration if you iterate
;; over the whole vector. Tracking extrema helps a bit.
@@ -223,12 +220,9 @@
(declare (type index new-size))
(setf (conset-vector conset)
(replace (the simple-bit-vector
- (make-array
- (power-of-two-ceiling new-size)
- :element-type 'bit
- :initial-element 0))
- (the simple-bit-vector
- (conset-vector conset)))))
+ (make-array (align-up new-size (* 2 sb-vm:n-word-bits))
+ :element-type 'bit :initial-element 0))
+ (conset-vector conset))))
(declaim (inline conset-grow))
(defun conset-grow (conset new-size)
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL