On Fri, 2023-09-29 at 11:39 +0200, Klaus Zimmermann wrote: > Hi, > > one thing that's been on my mind about this discussion: > > Isn't sorting strings simply a much harder job? Particularly Unicode > strings?
Yes, but in theory if they are length 1 it is just sorting integers (8 or 64bit) for the current quirky NumPy fixed-length string dtypes. Modulo complicated stuff that Python doesn't worry about either [1]. But, of course that is in theory. In practice have a single implementation that deals with arbitrary string lengths, so the code does a lot of extra stuff (and it is harder to use fancy tricks, and our implementation for a lot of these things is very basic). Also while we do have the flexibility to create it now, we don't actually have an obvious place where to add such a specialization (of course you can always insert an `if ...` clause somewhere, but that isn't a nice design). - Sebastian [1] In principle you are right: sorting unicode is complicated! In practice, that is your problem as a user though. If you want to deal with weirder things, you have to normalize the unicode first, etc. > > Cheers > Klaus > > On 27/09/2023 13:12, Lyla Watts wrote: > > Could you share the processor you're currently running this on? I > > ask because np.sort leverages AVX-512 acceleration for sorting > > np.int32, and I'm curious if that could be contributing to the > > observed difference in performance. > > https://apkhexo.com/koloro-mod-apk/ > > _______________________________________________ > > NumPy-Discussion mailing list -- numpy-discussion@python.org > > To unsubscribe send an email to numpy-discussion-le...@python.org > > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > > Member address: klaus.zimmerm...@smhi.se > _______________________________________________ > NumPy-Discussion mailing list -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: sebast...@sipsolutions.net > _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com