Subject: bug#15555: 24.3; Bidirectional display very slow with long lines

From: Eli Zaretskii <[email-masked]>
Date: Wed, 19 Feb 2014 19:39:57 +0200

> Date: Wed, 19 Feb 2014 14:49:39 +0400
> From: Dmitry Antipov <[email-masked]>
> CC: [email-masked]
> 
> On 02/18/2014 09:42 PM, Eli Zaretskii wrote:
> 
> > Anyway, just moving cursor horizontally cannot possibly be slow due to
> > bidi, especially as long as point stays in the same screenful.  The
> > redisplay becomes unbearably slow with long lines only when you either
> > scroll the display (e.g., C-v) or for vertical cursor motion, because
> > these require the display engine to traverse many buffer positions,
> > many more than is needed to just move the cursor, and it currently can
> > only start that traversal from the beginning of a physical line.
> 
> 1) I realize that vertical motion is slower than horizontal, but [2] from
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15555#65 shows that the major
> slowdown happens when cursor is moved horizontally (by right-char) within
> the same line.

According to the value of point that you gave, this happens when the
next buffer position, the one where right-char should move, is beyond
the window, i.e. not on the same screen line.

Did you try enlarging the window so that the entire text of 4000.txt
fits in the window?  Do you still see slow cursor movement in that
case?

> 2) (setq bidi-display-reordering nil) helps bug15555 to run over 4000.txt
> just as expected.

Of course, because then the bug I described, which causes endless
re-entering of redisplay, doesn't happen.

IOW, this is a bug in that specific situation, not a slow-down.