unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* master def6fa4246 2/2: Speed up string-lessp for multibyte strings
@ 2022-10-07 19:25 Eli Zaretskii
  2022-10-08 16:49 ` Mattias Engdegård
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-10-07 19:25 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

> +      /* 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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-09  8:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-07 19:25 master def6fa4246 2/2: Speed up string-lessp for multibyte strings Eli Zaretskii
2022-10-08 16:49 ` Mattias Engdegård
2022-10-08 17:40   ` Stefan Monnier
2022-10-09  8:42     ` Mattias Engdegård
2022-10-08 18:25   ` Eli Zaretskii
2022-10-08 19:01     ` Mattias Engdegård

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).