GNU bug report logs -
#27622
Trying to improve the speed of linum-mode
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 09 Jul 2017 21:27:25 +0300
with message-id <83bmotjwj6.fsf <at> gnu.org>
and subject line Re: bug#27622: Trying to improve the speed of linum-mode
has caused the debbugs.gnu.org bug report #27622,
regarding Trying to improve the speed of linum-mode
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
27622: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27622
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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?
[Message part 3 (message/rfc822, inline)]
> From: Fis Trivial <ybbs.daans <at> hotmail.com>
> CC: "27622 <at> debbugs.gnu.org" <27622 <at> debbugs.gnu.org>
> Date: Sun, 9 Jul 2017 18:06:18 +0000
>
> It's great. Now the Emacs works perfectly. Thanks for your work.
Thanks, closing.
This bug report was last modified 7 years and 300 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.