unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: contact@imrankhan.live, 48734@debbugs.gnu.org
Subject: bug#48734: 28.0.50; Performance regression in `string-width`?
Date: Sun, 30 May 2021 16:32:21 +0300	[thread overview]
Message-ID: <834kek4aai.fsf@gnu.org> (raw)
In-Reply-To: <87r1hoza6z.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun,  30 May 2021 14:18:44 +0200)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Imran Khan <contact@imrankhan.live>,  48734@debbugs.gnu.org
> Date: Sun, 30 May 2021 14:18:44 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > If deft-mode wants to allocate space on display, then they really do
> > need to use string-width, but then the changes which make them "hang"
> > are really important, because before that string-width would compute
> > the result incorrectly when characters are composed on display.
> 
> string-width has always been approximate (but fast), hasn't it?  And to
> determine the actual display width you've had to use
> window-text-pixel-size or the like.

That should still be the case, although string-width will now be a bit
slower when the string includes characters which need to be composed
on display.

> Perhaps string-width should get an extra parameter to get the new, more
> accurate computation, and get the old, fast computation without this
> parameter.

That's really easy with the last change I made: the option to do that
exists on the C level.  So if there are significant use cases where
people report slowdown, we could expose the option to Lisp.

FWIW, I did measure the speed after the change, and saw only something
like 10% slowdown for strings with composable characters.  Maybe my
tests were skewed, or maybe there are other use cases I didn't think
about.





  reply	other threads:[~2021-05-30 13:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 20:45 bug#48734: 28.0.50; Performance regression in `string-width`? Imran Khan
2021-05-30  6:42 ` Eli Zaretskii
     [not found]   ` <87y2bwk1nj.fsf@teknik.io>
2021-05-30 10:00     ` Eli Zaretskii
2021-05-30 11:23       ` Imran Khan
2021-05-30 12:05         ` Eli Zaretskii
2021-05-30 12:18           ` Lars Ingebrigtsen
2021-05-30 13:32             ` Eli Zaretskii [this message]
2021-05-31  5:41               ` Lars Ingebrigtsen
2021-05-31 12:36                 ` Imran Khan
2021-05-31 14:28                   ` Eli Zaretskii
2021-05-31 18:51                     ` Eli Zaretskii
2021-06-05 11:20                       ` Eli Zaretskii
2021-06-05 15:25                         ` Imran Khan
2021-06-05 15:45                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834kek4aai.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=48734@debbugs.gnu.org \
    --cc=contact@imrankhan.live \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).