all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: kfogel@red-bean.com, yates@digitalsignallabs.com, emacs-devel@gnu.org
Subject: Re: emacs takes exhorbitantly long to read long, one-line files.
Date: Mon, 20 May 2013 19:41:02 +0300	[thread overview]
Message-ID: <831u91wqn5.fsf@gnu.org> (raw)
In-Reply-To: <519A4E93.3060100@yandex.ru>

> Date: Mon, 20 May 2013 20:25:55 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: Karl Fogel <kfogel@red-bean.com>, yates@digitalsignallabs.com, 
>  emacs-devel@gnu.org
> 
> >    M->
> >    C-p
> >
> > and count the seconds it takes to perform the second command.
> >
> > What Emacs does behind the scenes is go to the beginning of the
> > previous _physical_ line (which is quite fast in this case), and the
> > go all the way down the humongously long line, one character at a
> > time, until it finds the place to put the cursor.  Unless we make
> > radical changes in this algorithm, how can anyone expect reasonable
> > performance from this?
> 
> This is pretty ugly because both previous-line and next-line uses
> Fforward_line, which uses scan_newline, which _does not_ use newline
> cache :-(.

Emacs doesn't use previous-line and next-line in the scenario I
described.  It uses back_to_previous_visible_line_start, which in turn
uses find_newline_no_quit, and that does use the cache.

But you are missing the point.  First, this particular file has only
one line, so not using the cache means we only miss a single newline.
More importantly, even if we do cache newlines, how will that help us
with such long lines?  It should be clear that traversing such lines
from left to right, one character at a time, is _the_ bottleneck, not
how fast can we find the previous/next newline.



  reply	other threads:[~2013-05-20 16:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19  3:52 emacs takes exhorbitantly long to read long, one-line files Randy Yates
2013-05-19 14:41 ` Eli Zaretskii
2013-05-20  8:40 ` Dmitry Antipov
2013-05-20 11:03   ` Randy Yates
2013-05-20 11:27     ` Dmitry Antipov
2013-05-20 14:32       ` Karl Fogel
2013-05-20 15:59         ` Eli Zaretskii
2013-05-20 16:25           ` Dmitry Antipov
2013-05-20 16:41             ` Eli Zaretskii [this message]
2013-05-20 21:43           ` Randy Yates
2013-05-21  2:21             ` Stephen J. Turnbull
2013-05-21  2:47             ` Eli Zaretskii
2013-05-21  7:57           ` Ulrich Mueller
2013-05-21 10:20             ` Dmitry Antipov
2013-05-21 12:06               ` Ulrich Mueller
2013-05-21 17:21                 ` Eli Zaretskii
2013-05-21 17:18               ` Eli Zaretskii
2013-05-21 17:55             ` Eli Zaretskii
2013-05-21 18:03               ` Randy Yates
2013-05-21 18:28                 ` Dmitry Antipov
2013-05-22  5:10               ` Ulrich Mueller
2013-05-22 14:51                 ` 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

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

  git send-email \
    --in-reply-to=831u91wqn5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=kfogel@red-bean.com \
    --cc=yates@digitalsignallabs.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.