Subject: Re: bug#17404: Scrolling is painfully slow

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 May 2014 16:21:29 +0300

> Date: Tue, 06 May 2014 15:47:25 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > Date: Tue, 06 May 2014 07:42:47 -0400
> > From: Richard Stallman <[email-masked]>
> > CC: [email-masked]
> > 
> > I should explain that I configured Emacs to visit that file in Rmail mode.
> > Try it that way.
> 
> I did.  I used "C-u M-x rmail RET foo2.mail RET" in "emacs -Q".  Does
> that reproduce the problem on your system?
> 
> What about "emacs -nw" -- do you see the same slowdown there?  Or is
> the problem limited to the GUI sessions?

Also, could you please try profiling Emacs and reporting the results?
Like this:

  M-x load-file RET simple.el RET
  C-u M-x rmail RET foo2.mail RET
  C-s GNU Emacs
  C-f
  M-x profiler-start RET RET

Now press and hold C-n for 5 seconds, then release C-n and type

  M-x profiler-report RET

In the buffer with the profile, please type "C-u RET" on every line
that has a "+" to its left, to completely expand the profile.  Then
please post the result.

Here's my profile:

  - command-execute                                                 159 100%
   - let                                                            159 100%
    - if                                                            159 100%
     - let                                                          159 100%
      - cond                                                        159 100%
       - prog1                                                      159 100%
	- call-interactively                                        159 100%
	 - next-line                                                150  94%
	  - if                                                      150  94%
	   - if                                                     150  94%
	    - condition-case                                        150  94%
	     - line-move                                            150  94%
	      - if                                                  150  94%
	       - if                                                 150  94%
		- if                                                150  94%
		 - prog1                                            150  94%
		  - line-move-visual                                103  64%
		   - let                                            103  64%
		    - or                                             99  62%
		     - and                                           99  62%
		      - or                                           99  62%
		       - and                                         99  62%
			  >=                                         99  62%
		    - if                                              4   2%
		       let                                            4   2%
		    let                                              47  29%
	 - list                                                       9   5%
	  - read-extended-command                                     9   5%
	   - let                                                      9   5%
	    - unwind-protect                                          9   5%
	     - progn                                                  9   5%
	      - completing-read                                       9   5%
	       - completing-read-default                              9   5%
		  read-from-minibuffer                                9   5%
  - ...                                                               0   0%
     Automatic GC                                                     0   0%

This seems to indicate that line-move and line-move-visual take most
of the time.  If you get a similar result, then please try replacing
these 2 functions with their code from May 2013, and see if that makes
the slowdown go away.