From: JD Smith <jdtsmith@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Temporarily select-window, without updating mode-line face and cursor fill?
Date: Tue, 4 May 2021 15:28:57 -0400 [thread overview]
Message-ID: <F8C2D306-BCDB-410F-ACAD-F8BA6CFB5664@gmail.com> (raw)
In-Reply-To: <jwvlf8wwogv.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]
> On May 2, 2021, at 10:25 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> (setq nlinum--line-number-cache nil))
Taking a closer look at Stefan’s idea here, and considering the concerns people have about the set-window-point/format-mode-line approach, I have implemented a new caching system based on nlinum, with the regular old line-number-at-pos and count-lines underneath; see:
https://github.com/jdtsmith/mlscroll/blob/07a657d28d779c3bc56b0a2ea04cfc6d23c54897/mlscroll.el#L87
Neither format-mode-line nor window-point manipulation is needed now. Unlike nlinum, it also does not require an after-change-function, opting instead to save a buffer tick and point-min/max to look for buffer modifications and any narrowing/widening. In practice it entirely solves the long file scrolling bottleneck, since effectively all line lookups during scrolling hit the cache, and cached computation of all 3 line positions is >50x faster than even format-mode-line was.
Thanks all for your suggestions/criticism/feedback. What I can conclude is that the default approach line-number-at-pos takes of “counting all newlines from the start of the file” is really painfully inefficient.
[-- Attachment #2: Type: text/html, Size: 2675 bytes --]
next prev parent reply other threads:[~2021-05-04 19:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 18:46 Temporarily select-window, without updating mode-line face and cursor fill? JD Smith
2021-05-01 19:31 ` Eli Zaretskii
2021-05-01 20:32 ` JD Smith
2021-05-02 6:49 ` Eli Zaretskii
2021-05-03 2:15 ` JD Smith
2021-05-03 7:50 ` martin rudalics
2021-05-03 16:16 ` JD Smith
2021-05-03 17:32 ` martin rudalics
2021-05-02 7:40 ` martin rudalics
2021-05-03 2:23 ` JD Smith
2021-05-01 22:17 ` JD Smith
2021-05-02 6:55 ` Eli Zaretskii
2021-05-03 2:08 ` JD Smith
2021-05-03 2:25 ` Stefan Monnier
2021-05-03 2:49 ` JD Smith
2021-05-04 19:28 ` JD Smith [this message]
2021-05-04 19:40 ` Stefan Monnier
2021-05-05 0:49 ` Stefan Kangas
2021-05-05 11:54 ` Eli Zaretskii
2021-05-05 19:32 ` Stefan Kangas
2021-05-05 19:47 ` Stefan Monnier
2021-05-06 0:16 ` JD Smith
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=F8C2D306-BCDB-410F-ACAD-F8BA6CFB5664@gmail.com \
--to=jdtsmith@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.