[Numpy-discussion] String sort

Charles R Harris charlesr.harris@gmail....
Fri Feb 8 15:38:18 CST 2008

On Feb 8, 2008 8:58 AM, Francesc Altet <faltet@carabos.com> wrote:

> A Friday 08 February 2008, Charles R Harris escrigué:
> > > Also, in the context of my work in indexing, and because of the
> > > slowness of the current implementation in NumPy, I've ended with an
> > > implementation of the quicksort method for 1-D array strings.  For
> > > moderately large arrays, it is about 2.5x-3x faster than the
> > > (supposedly) mergesort version in NumPy, not only due to the
> > > quicksort, but also because I've implemented a couple of macros for
> > > efficient string swapping and copy.  If this is of interest for
> > > NumPy developers, tell me and I will provide the code.
> >
> > I have some code for this too and was going to merge it. Send yours
> > along and I'll get to it this weekend.
> Ok, great.  I'm attaching it.  Tell me if you need some clarification on
> the code.

I ran a few timing tests. On my machine strncmp is about 100x faster than
opt_strncmp, but  sSWAP (with some fixes), is about 10x faster then using
the memcpy in a recent compiler. Does this match with your experience.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080208/0239ea08/attachment.html 

More information about the Numpy-discussion mailing list