Alain M. Lafon, whom I’ve mentioned several times before (1, 2, 3, 4, 5), has posted a useful guide for dealing with long lines in Emacs. One of Emacs’ well known weaknesses is that it can become very slow when it’s dealing with long lines. Usually this happens with programmatically generated files with extremely long lines but Lafon says that it can also happen with lines of a couple thousand characters.
Fortunately, there are some steps you can take to remediate the problem. Lafon offers several suggestions. One of the most effective strategies is to use Phil Sainty’s so-long library that I wrote about previously. Happily, as of Emacs 27.1, so-long is a standard part of Emacs so you won’t have to do anything but enable it. Even if you’re running an older version, you can still install it as a package.
Another remediation is to disable certain features of the bidirectional display facility. Unless you’re using both left-to-right and right-to-left display in the same file—see Lafon’s post for how this can happen naturally—you can reduce the number of times a lines has to be scanned by disabling some of the bidirectional capabilities.
If you’re having problems with long lines, take a look at Lafon’s post. He has several suggestions for helping to make Emacs a bit faster in working with them.