Attached is a patch to enable an optimized REPLACE on most (all?) types
of specialized SIMPLE-ARRAYs which SBCL supports. I think the logic is
The comments in src/compiler/seqtran.lisp seem to be a mixed bag. Before
the DEFTRANSFORM for REPLACE, we see:
;;;; FIXME: It would be nicer for these transforms to work for any
;;;; calls when all arguments are vectors with the same element type,
;;;; rather than restricting them to STRINGs only.
Then there was the appropriate magic for REPLACE and a bit further down
;;; also, it should be noted that there's nothing much in this
;;; transform (as opposed to the ones for REPLACE and CONCATENATE)
;;; that particularly limits it to SIMPLE-BASE-STRINGS.
(DEFTRANFORM SEARCH ...
What, exactly, limits the transform for REPLACE to SIMPLE-BASE-STRINGS?
I looked at it and didn't see much. (I suppose this applies for
Another sequence function which could use some DEFTRANSFORMing is FILL,
in src/compiler/generic/vm-tran.lisp. It's defined for SIMPLE-BIT-VECTORs
and SIMPLE-BASE-STRINGs--it could easily be defined for other specialized
array types. I plan to do this, but I am curious: does anybody know
why the transforms for FILL don't use SB-KERNEL:BIT-BASH-FILL? Seems
like the latter function would be perfect for this work. CMUCL didn't
use BIT-BASH-FILL, so either there's a good reason or it was just an
Nathan | http://www.cs.rose-hulman.edu/~froydnj/ | Credo ut intelligam
From Man's effeminate slackness it begins. --Paradise Lost