all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fis Trivial <ybbs.daans@hotmail.com>
To: 27622@debbugs.gnu.org
Subject: bug#27622: Trying to improve the speed of linum-mode
Date: Sat, 8 Jul 2017 09:25:38 +0000	[thread overview]
Message-ID: <BN6PR16MB185969FF5930737FF29C8F2A92AB0@BN6PR16MB1859.namprd16.prod.outlook.com> (raw)

For some reasons, the linum-mode needs to go over the whole buffer in
order to update the line numbers. It's ok when viewing a small buffer,
but when comes to something large it will slow the emacs down like I
was viewing a ppt(try kernel patch). I don't really understand the
code, but I changed it a little bit and it works fine so far. Here is
the patch, linum-o.el is the original code:




--- linum-o.el	2017-06-06 09:04:32.012568000 +0800
+++ linum.el	2017-07-
08 16:45:45.710518928 +0800
@@ -174,7 +174,7 @@
         (fmt (cond
((stringp linum-format) linum-format)
                    ((eq linum-
format 'dynamic)
                     (let ((w (length (number-to-string

-                                      (count-lines (point-min) (point-
max))))))
+                                      (count-lines (window-
start win) (window-end win t))))))
                       (concat "%"
(number-to-string w) "d")))))
         (width 0))
     (run-hooks 'linum-
before-numbering-hook)




The minor change replaced (point-min/max) to (window-start/end) which
saves a lots of iterations and did improve the speed at start-up. but
if I move the cursor to the end of the buffer, it slows down again and
I don't know why it's happening.
So, I got wonder is there any particular reason to use (point-min)
instead of (window-start)? And what's the cause of slowing down when I
move the cursor to the end of buffer?

             reply	other threads:[~2017-07-08  9:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-08  9:25 Fis Trivial [this message]
2017-07-08 17:01 ` bug#27622: Trying to improve the speed of linum-mode Eli Zaretskii
     [not found]   ` <BN6PR16MB1859AD697302D7AD9BCFE79D92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-08 18:55     ` Eli Zaretskii
     [not found]       ` <BN6PR16MB1859941C3153757777556D4192AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-08 19:44         ` Eli Zaretskii
     [not found]           ` <BN6PR16MB185932C3CF6DFA06F47DAA8A92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-09 14:39             ` Eli Zaretskii
2017-07-09 18:06               ` Fis Trivial
2017-07-09 18:27                 ` Eli Zaretskii
2017-07-09 23:29   ` Glenn Morris
2017-07-10 16:50     ` Eli Zaretskii
2017-07-31  2:06       ` Glenn Morris
2017-07-31  3:11         ` 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=BN6PR16MB185969FF5930737FF29C8F2A92AB0@BN6PR16MB1859.namprd16.prod.outlook.com \
    --to=ybbs.daans@hotmail.com \
    --cc=27622@debbugs.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.
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.