Subject: bug#40007: 28.0.50; Emacs gets very slow when displaying a long line

From: Phil Sainty <[email-masked]>
Date: Tue, 24 Mar 2020 21:49:19 +1300

On 10/03/20 11:46 pm, Pieter van Oostrum wrote:
> Jan Synacek <[email-masked]> writes:
>
>> 1) emacs -Q
>> 2) M-x shell
>> 3) execute a program that displays a single line, about ~193000
>> characters long
>
> Use so-long-mode.

For clarity, global-so-long-mode isn't going to help with that
recipe, because it doesn't try to detect the *dynamic* creation of
very long lines.  It only cares about visiting files.

In principle it can be employed successfully in other situations,
but for now it's up to users to target such things explicitly.
E.g.:
https://www.reddit.com/r/emacs/comments/ccoksw/solong_mitigating_slowness_due_to_extremely_long/etpi51l/

Note that you probably shouldn't invoke major mode so-long-mode in
a shell-mode buffer, but so-long-minor-mode could help somewhat if
it were enabled.  I think only slightly, though -- in this instance
you'll end up with the *end* of a very long line on display, and so
performance is going to be fairly poor regardless.  Certainly in my
test it didn't make a dramatic difference.  (The really major
benefits of so-long are in preventing certain serious problems
which can occur even when only the start of the line is visible,
and in those situations the improvements can be extremely good.)

As Eli says, the library alleviates some of the problems -- but
only some of them.

-Phil