From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48734: 28.0.50; Performance regression in `string-width`? Date: Sun, 30 May 2021 16:32:21 +0300 Message-ID: <834kek4aai.fsf@gnu.org> References: <87a6odmfp6.fsf@teknik.io> <83o8cs4t9m.fsf@gnu.org> <87y2bwk1nj.fsf@teknik.io> <83eedo4k3j.fsf@gnu.org> <87v970jwik.fsf@teknik.io> <835yz04ean.fsf@gnu.org> <87r1hoza6z.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31526"; mail-complaints-to="usenet@ciao.gmane.io" Cc: contact@imrankhan.live, 48734@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 30 15:33:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnLYz-00080H-Es for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 15:33:09 +0200 Original-Received: from localhost ([::1]:58710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnLYy-0004x6-Hs for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 May 2021 09:33:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnLYs-0004wx-UZ for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 09:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnLYs-0007kE-Mb for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 09:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnLYs-0004Fg-Ii for bug-gnu-emacs@gnu.org; Sun, 30 May 2021 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2021 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48734 X-GNU-PR-Package: emacs Original-Received: via spool by 48734-submit@debbugs.gnu.org id=B48734.162238154216292 (code B ref 48734); Sun, 30 May 2021 13:33:02 +0000 Original-Received: (at 48734) by debbugs.gnu.org; 30 May 2021 13:32:22 +0000 Original-Received: from localhost ([127.0.0.1]:58530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnLYE-0004Ei-5S for submit@debbugs.gnu.org; Sun, 30 May 2021 09:32:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnLYA-0004ES-Qu for 48734@debbugs.gnu.org; Sun, 30 May 2021 09:32:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39544) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnLY5-0007EF-0f; Sun, 30 May 2021 09:32:13 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4769 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnLY4-0006IL-J0; Sun, 30 May 2021 09:32:12 -0400 In-Reply-To: <87r1hoza6z.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 30 May 2021 14:18:44 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207616 Archived-At: > From: Lars Ingebrigtsen > Cc: Imran Khan , 48734@debbugs.gnu.org > Date: Sun, 30 May 2021 14:18:44 +0200 > > Eli Zaretskii 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.