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: Mon, 31 May 2021 17:28:44 +0300 Message-ID: <837djf2d0j.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> <834kek4aai.fsf@gnu.org> <87h7ijlats.fsf@gnus.org> <87y2bvozaf.fsf@teknik.io> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23275"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 48734@debbugs.gnu.org To: Imran Khan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 31 16:30:48 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 1lniwK-0005nr-DW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 May 2021 16:30:48 +0200 Original-Received: from localhost ([::1]:57380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lniwJ-0001PJ-5t for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 May 2021 10:30:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lniuc-0000L3-TK for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 10:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lniuc-0000Ru-Dd for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 10:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lniuc-0004Az-A5 for bug-gnu-emacs@gnu.org; Mon, 31 May 2021 10:29: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: Mon, 31 May 2021 14:29: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.162247133916045 (code B ref 48734); Mon, 31 May 2021 14:29:02 +0000 Original-Received: (at 48734) by debbugs.gnu.org; 31 May 2021 14:28:59 +0000 Original-Received: from localhost ([127.0.0.1]:34587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lniuZ-0004Aj-MA for submit@debbugs.gnu.org; Mon, 31 May 2021 10:28:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lniuX-0004AV-W2 for 48734@debbugs.gnu.org; Mon, 31 May 2021 10:28:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:46294) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lniuS-0000L6-EL; Mon, 31 May 2021 10:28:52 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1762 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 1lniuS-0007zf-1b; Mon, 31 May 2021 10:28:52 -0400 In-Reply-To: <87y2bvozaf.fsf@teknik.io> (message from Imran Khan on Mon, 31 May 2021 18:36:40 +0600) 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:207701 Archived-At: > From: Imran Khan > Cc: 48734@debbugs.gnu.org > Date: Mon, 31 May 2021 18:36:40 +0600 > > But I believe what triggers the hanging behaviour for deft-mode is that > they are doing (among other things) a text transformation of stripping > all vertical whitespace in string to make it look flat: > > https://github.com/jrblevin/deft/blob/c4af44827f4257e7619e63abfd22094a29a9ab52/deft.el#L678 > > Which we can replicate with string-replace: > > (benchmark-run 1 > (let ((str)) > (with-temp-buffer > (insert-file-contents "~/2591-0.txt") > (setq str (string-replace "\n" " " (buffer-string)))) > (print (string-width str)))) ;;;; beware this now hangs > > I waited a minute for it to finish before killing Emacs. Why would someone want to measure the visible width of a 550KB string? Is that a real-life use case? But I think I see the reason, and will try to improve this.