unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jiaxin Cao <jiaxin.cao@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Why emacs rendering is slow when encountering long lines?
Date: Sun, 20 Oct 2013 19:08:51 -0700 (PDT)	[thread overview]
Message-ID: <d3882c10-f6a9-4c36-8593-9f71477fb5e0@googlegroups.com> (raw)
In-Reply-To: <mailman.4348.1382285387.10748.help-gnu-emacs@gnu.org>

On Monday, October 21, 2013 12:09:26 AM UTC+8, Allan Streib wrote:
> Jiaxin Cao <jiaxin.cao@gmail.com> 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.


  parent reply	other threads:[~2013-10-21  2:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-20  5:00 Why emacs rendering is slow when encountering long lines? Jiaxin Cao
2013-10-20 10:25 ` Jiaxin Cao
2013-10-20 15:38   ` Eli Zaretskii
2013-10-20 15:50   ` Dan Espen
2013-10-20 16:07     ` Eli Zaretskii
2013-10-20 16:09 ` Allan Streib
     [not found] ` <mailman.4348.1382285387.10748.help-gnu-emacs@gnu.org>
2013-10-21  2:08   ` Jiaxin Cao [this message]
2013-10-21  3:00     ` Eli Zaretskii
2013-10-21 14:39       ` Jules Colding
2013-10-21 16:36         ` Eli Zaretskii
2013-10-21 16:16       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3882c10-f6a9-4c36-8593-9f71477fb5e0@googlegroups.com \
    --to=jiaxin.cao@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).