Subject: bug#10835: 24.0.93; bidi-paragraph-direction slows down Shell mode

From: Eli Zaretskii <[email-masked]>
Date: Fri, 17 Feb 2012 18:08:47 +0200

> From: Chong Yidong <[email-masked]>
> Date: Fri, 17 Feb 2012 13:48:26 +0800
> 
> It happens on both GUI sessions and TTY, run locally on an Intel i7
> processor; Emacs was compiled without optimizations.

On an i7, I'd expect no slowdown at all.

How much time does it take `ls' to produce that 2K-line listing on
your machine, outside of Emacs and with a warm cache?

Also, can you put a printf after this line from xdisp.c:

  else if (it->bidi_it.charpos == bob
	   || (!string_p
	       && (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
		   || FETCH_CHAR (it->bidi_it.bytepos) == '\n')))
    {
      /* If we are at the beginning of a line/string, we can produce
	 the next element right away.  */
      bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); <<<<<<

and tell me once in how many characters or lines of input from `ls' is
bidi_paragraph_init called here?  E.g., to see the character count,
print it->bidi_it.charpos just before that line.  (You could do the
same from breakpoint commands, but I'm afraid that doing so will
change the timing of how frequently the process output is read by
Emacs, and will therefore produce a biased estimation.)

TIA