[Openmcl-devel] string handling question
Pascal J.Bourguignon
pjb at informatimago.com
Tue Nov 9 08:49:26 PST 2004
alex crain writes:
> No, not homework :-)
>
> (subseq "asd" 1 2) eventually calls (%substr "asdf" 1 2) once it
> satisfies all it's criteria.
> I'm looking for a similar optimization for FIND and friends when the
> argument is a string.
>
> For example,
> (FIND #\s "mystring")
> eventually boils down to
> (dovector (a "mystring")
> (when (eq a #\s) (return a)))
> but some implementations of strchr are smarter then that and would do
> things in 4 or
> 8 byte chunks.
I don't see how you can simply find a byte in a word, unless you have
a microcode op to do it.
Perhaps you mean that what is optimized the the loading from memory?
Load a bus-width worth of bit, and test each bytes in the word in
registers. But since the data is in the L1 cache anyway, I'm not sure
you'd gain anything.
ISTR the PPC has shift/rotate circuitry for fast access of bytes
inside a word. So it may be worthwhile to implement some assembler to
do it.
> Since I'm working on an OpenMCL editor, implementation dependence is
> not a problem.
It seems that the implementation of OpenMCL POSITION eventually use a
mere: ("ccl/libs/sequences.lisp").
(dotimes (i (length vector) (if (eql element (aref vector i)) (return i))))
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.
More information about the Openmcl-devel
mailing list