Juho Snellman <jsnell@...> writes:
> - x86 only, since other architectures don't support SYMBOL-HASH.
> I've seen some vague references in source code comments, mailing
> list archives and blogs about SYMBOL-HASH being only meant for
> GEN(C)GC, but everyone seems to have forgotten the details.
Given that the non-x86 name for that slot is "unused", it ought to be
possible to make it contain the hash value...
> - Makes MAKE-SYMBOL slower by 50%-100%. Some of the lost performance
> might regained by inlining or other optimizations, but since
> MAKE-SYMBOL seems like a rather unlikely bottleneck I didn't
> look into it.
What would the effect be of altering sxhash on symbols to
(let ((result (symbol-hash symbol)))
(if (minusp result)
(setf (symbol-hash symbol) (%sxhash-simple-substring ...))
? In other words, to cache the hash value at the first call to
sxhash, so that throwaway symbols don't incur the penalty?
> --- src/code/sxhash.lisp 15 Sep 2003 09:21:38 -0000 1.5
> +++ src/code/sxhash.lisp 10 May 2004 21:31:21 -0000
> @@ -104,6 +104,5 @@
> (deftransform sxhash ((x) (symbol))
> (if #+sb-xc-host nil #-sb-xc-host (constant-lvar-p x)
> (sxhash (lvar-value x))
While we're at it, are there any calls to sxhash on constant symbols
within the system? If there are, then this could be replaced by
(if (constant-lvar-p x)
#+sb-xc-host '(load-time-value (sxhash (lvar-value x)))
#-sb-xc-host (sxhash (lvar-value x))
> - '(%sxhash-simple-string (symbol-name x))))
> + '(symbol-hash x)))
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)