help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why emacs rendering is slow when encountering long lines?


From: Jiaxin Cao
Subject: Re: Why emacs rendering is slow when encountering long lines?
Date: Sun, 20 Oct 2013 19:08:51 -0700 (PDT)
User-agent: G2/1.0

On Monday, October 21, 2013 12:09:26 AM UTC+8, Allan Streib wrote:
> Jiaxin Cao <address@hidden> writes:
> 
> 
> 
> > When I open a file containing long lines, it is not smooth to scroll up and 
> > down, even if the file is not large. 
> 
> 
> 
> Have you tried enabling truncate-lines? I realize this is a matter of
> 
> subjective preference, but I generally prefer this for any programming
> 
> modes (I only wrap long lines for reading text e.g. email)
> 
> 
> 
> Allan

Yes, I tried both cases with truncate-lines enabled and disabled. Scroll-down 
is bad in both cases. Scroll-up behaves a little better. 

Let me provide more information about this. To reproduce the scenario, just 
create a line containing about 450 chars, and copy the line 10000 times. I use 
the text-mode to test this buffer. Scroll-down means the cursor goes up. My OS 
is windows 8. Emacs version is 24.3.1.

I think this is not the problem of the rendering engine. You can do some tests 
like this. 
(defun test-redraw-display ()
  (interactive)
  (message (format-time-string "%Y-%m-%dT%T:%6N"))
  (redraw-display)
  (message (format-time-string "%Y-%m-%dT%T:%6N")))

(defun test-scroll-down ()
  (interactive)
  (message (format-time-string "%Y-%m-%dT%T:%6N"))
  (scroll-down)
  (message (format-time-string "%Y-%m-%dT%T:%6N")))

(defun test-scroll-up ()
  (interactive)
  (message (format-time-string "%Y-%m-%dT%T:%6N"))
  (scroll-up)
  (message (format-time-string "%Y-%m-%dT%T:%6N")))

Here is the test results on the buffer mentioned above.
|-------------------------+----------------+-------------+-----------|
|                         | redraw-display | scroll-down | scroll-up |
|-------------------------+----------------+-------------+-----------|
| Truncate-lines enabled  | < 1ms          | 82ms        | 47ms      |
| Truncate-lines disabled | < 1ms          | 76ms        | 54ms      |
|-------------------------+----------------+-------------+-----------|

Based on the results, I guess the scroll-down is the bottleneck of the 
scrolling performance. I know scroll-down is a little complicated to implement, 
but if you  do the same thing in notepad, you'll find notepad is way smoother 
than emacs in term of scrolling.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]