GNU bug report logs - #48839
28.0.50; Emacs freezes and takes 100% CPU with C-h v l

Previous Next

Package: emacs;

Reported by: Tassilo Horn <thorn <at> fastmail.fm>

Date: Fri, 4 Jun 2021 22:48:02 UTC

Severity: normal

Merged with 48840

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 48839 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <thorn <at> fastmail.fm>
Cc: mail <at> daniel-mendler.de, 48839 <at> debbugs.gnu.org, Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: 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
> From: Tassilo Horn <thorn <at> fastmail.fm>
> Cc: 48839 <at> debbugs.gnu.org, mail <at> 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 \#\<buffer\ marginalia.el\> /home/horn/.emacs.d/elpa/marginalia-20210530.158/marginalia.el /tmp/buffer-content-yqLXyF
> --- /home/horn/.emacs.d/elpa/marginalia-20210530.158/marginalia.el
> +++ #<buffer 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.




This bug report was last modified 4 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.