bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48734: 28.0.50; Performance regression in `string-width`?


From: Eli Zaretskii
Subject: bug#48734: 28.0.50; Performance regression in `string-width`?
Date: Mon, 31 May 2021 17:28:44 +0300

> From: Imran Khan <contact@imrankhan.live>
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]