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#48839: 28.0.50; Emacs freezes and takes 100% CPU with C-h v l Date: Sat, 05 Jun 2021 11:39:16 +0300 Message-ID: <83y2bok8nf.fsf@gnu.org> References: <87czt16ydq.fsf@fastmail.fm> <83bl8kltb8.fsf@gnu.org> <87wnr8ohk5.fsf@fastmail.fm> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10800"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mail@daniel-mendler.de, 48839@debbugs.gnu.org, Tassilo Horn To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 05 10:40: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 1lpRqj-0002fn-MA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 10:40:09 +0200 Original-Received: from localhost ([::1]:53692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpRqi-0000On-N9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Jun 2021 04:40:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpRqc-0000Od-JV for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 04:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpRqc-0004BD-DV for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 04:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpRqc-0000tH-8l for bug-gnu-emacs@gnu.org; Sat, 05 Jun 2021 04:40: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: Sat, 05 Jun 2021 08:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48839 X-GNU-PR-Package: emacs Original-Received: via spool by 48839-submit@debbugs.gnu.org id=B48839.16228823813392 (code B ref 48839); Sat, 05 Jun 2021 08:40:02 +0000 Original-Received: (at 48839) by debbugs.gnu.org; 5 Jun 2021 08:39:41 +0000 Original-Received: from localhost ([127.0.0.1]:48299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpRqG-0000sd-Nm for submit@debbugs.gnu.org; Sat, 05 Jun 2021 04:39:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpRqE-0000sQ-Cg for 48839@debbugs.gnu.org; Sat, 05 Jun 2021 04:39:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43960) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpRq8-0003qt-Se; Sat, 05 Jun 2021 04:39:32 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3611 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 1lpRpw-0003z7-1q; Sat, 05 Jun 2021 04:39:32 -0400 In-Reply-To: <87wnr8ohk5.fsf@fastmail.fm> (message from Tassilo Horn on Sat, 05 Jun 2021 10:11:28 +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:208048 Archived-At: > From: Tassilo Horn > Cc: 48839@debbugs.gnu.org, mail@daniel-mendler.de > Date: Sat, 05 Jun 2021 10:11:28 +0200 > > > string-width on the current master has a design bug, which causes it > > to be VERY slow on very long strings, if those strings don't include > > newlines or similar characters. I'm working on fixing that design > > bug, but meanwhile: why does marginalia need to compute the width of > > such very long strings? that sounds like a design bug in marginalia. > > The simplest fix is not to compute string-width of any string whose > > length is greater than, say, 300 characters. Does that help in this > > case? > > Yes, with this patch I can make the issue go away with no observable > difference in the things marginalia displays. > > --8<---------------cut here---------------start------------->8--- > diff -u --label /home/horn/.emacs.d/elpa/marginalia-20210530.158/marginalia.el --label \#\ /home/horn/.emacs.d/elpa/marginalia-20210530.158/marginalia.el /tmp/buffer-content-yqLXyF > --- /home/horn/.emacs.d/elpa/marginalia-20210530.158/marginalia.el > +++ # > @@ -450,8 +450,12 @@ > ((marginalia--symbol-class sym) :face 'marginalia-type) > ((let ((print-escape-newlines t) > (print-escape-control-characters t) > - (print-escape-multibyte t)) > - (prin1-to-string (if (boundp sym) (symbol-value sym) 'unbound))) > + (print-escape-multibyte t) > + (str-val (prin1-to-string > + (if (boundp sym) > + (symbol-value sym) > + 'unbound)))) > + (substring str-val 0 (min (length str-val) 300))) Great, thanks. (An alternative is to use the result of 'length' for strings longer than 300 characters, or map 'char-width' on its characters, adding the results.) I will work on fixing string-width.