emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master def6fa4246 2/2: Speed up string-lessp for multibyte strings


From: Eli Zaretskii
Subject: master def6fa4246 2/2: Speed up string-lessp for multibyte strings
Date: Fri, 07 Oct 2022 22:25:21 +0300

> +      /* Two arbitrary multibyte strings: we cannot use memcmp because
> +      the encoding for raw bytes would sort those between U+007F and U+0080
> +      which isn't where we want them.
> +      Instead, we skip the longest common prefix and look at
> +      what follows.  */

I don't think I understand this; please elaborate.  Didn't you say
that we never need to look beyond the first unequal byte?  Then why
does the order of raw bytes matter here?

Did you consider using memmem?

> +      /* First compare entire machine words.  (String data is allocated
> +      with word alignment.)  */
> +      typedef size_t word_t;
> +      int ws = sizeof (word_t);

Are you sure about the alignment?  Can you show the details of your
reasoning about it?  At the very least, we should have an assertion
here verifying the alignment.

Also, what about AUTO_STRING -- is that also guaranteed to be aligned
as this code assumes?

And finally: why no tests for this?  We are changing a central part of
our code, and it would be unthinkable to do that without a test suite.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]