bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#77684: [PATCH] ; * lisp/emacs-lisp/vtable.el (vtable--limit-string):


From: Eli Zaretskii
Subject: bug#77684: [PATCH] ; * lisp/emacs-lisp/vtable.el (vtable--limit-string): Use binary search
Date: Wed, 23 Apr 2025 15:06:07 +0300

> From: Kristoffer Balintona <krisbalintona@gmail.com>
> Date: Tue, 22 Apr 2025 17:36:32 -0400
> Cc: 77684@debbugs.gnu.org
> 
> On Tue, Apr 15 2025, Eli Zaretskii wrote:
> 
> > Perhaps we could still use binary search, but augment it as follows:
> > when a match is found by binary search, run an additional loop, which
> > adds back one character at a time, as long as string-pixel-width
> > returns the same value.  The last character added which still yields
> > the same value will be the point where to truncate the string.
> >
> > For long enough strings, this might still be a win, even if characters
> > are composed.  And for the simple case of characters that are not
> > composed, this adds just one extra call to string-pixel-width.
> 
> Thank you for the suggestion, Eli. Unfortunately, I wasn't able to find
> an implementation that worked exhaustively. I ran into trouble I
> couldn't resolve when the match returned by the binary search landed
> within a ligature/emoji (which can span multiple characters without
> necessarily changing the pixel width in predictable, monotonic ways).
> 
> Aside from those cases, I think the binary search works quite well.
> However, since it doesn't cover all the cases the current implementation
> does, I think the current implementation should be kept.
> 
> I may return to this in the future, but for now I think if developers
> need performance, they should set the displayer themselves (which I will
> do for my own personal projects).

Thanks.  So let's close this bug for now.  If someone has clever ideas
how to speed up vtable--limit-string, we can always reopen.





reply via email to

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