[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27622: Trying to improve the speed of linum-mode
From: |
Fis Trivial |
Subject: |
bug#27622: Trying to improve the speed of linum-mode |
Date: |
Sat, 8 Jul 2017 09:25:38 +0000 |
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?
- bug#27622: Trying to improve the speed of linum-mode,
Fis Trivial <=
- bug#27622: Trying to improve the speed of linum-mode, Eli Zaretskii, 2017/07/08
- Message not available
- bug#27622: Trying to improve the speed of linum-mode, Eli Zaretskii, 2017/07/08
- Message not available
- bug#27622: Trying to improve the speed of linum-mode, Eli Zaretskii, 2017/07/08
- Message not available
- bug#27622: Trying to improve the speed of linum-mode, Eli Zaretskii, 2017/07/09
- bug#27622: Trying to improve the speed of linum-mode, Fis Trivial, 2017/07/09
- bug#27622: Trying to improve the speed of linum-mode, Eli Zaretskii, 2017/07/09
bug#27622: Trying to improve the speed of linum-mode, Glenn Morris, 2017/07/09