[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-goggles d3222f8b07 219/225: speedup: count-lines inst
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-goggles d3222f8b07 219/225: speedup: count-lines instead of substracting line-number-at-pos's |
Date: |
Wed, 12 Jan 2022 08:59:10 -0500 (EST) |
branch: elpa/evil-goggles
commit d3222f8b075438ea111a3a002ca4a625e66fe203
Author: Kevin Brubeck Unhammer <unhammer@fsfe.org>
Commit: Kevin Brubeck Unhammer <unhammer@fsfe.org>
speedup: count-lines instead of substracting line-number-at-pos's
Before this change, doing a simple `x` on line 144213 of a big file
would make line-number-at-pos count lines from point-min, taking
several seconds on my machine. Since we're looking for both beg and
end (which happen to be one character apart), this counts all 144213
lines twice. The count-lines function instead narrows the buffer
first, eradicating the slowdown.
(See
https://bitbucket.org/lyro/evil/pull-requests/32/count-lines-much-faster-than-subtracting/diff
which regards a similar change to evil.)
---
evil-goggles.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/evil-goggles.el b/evil-goggles.el
index 1690a0237f..fe25914c3d 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -136,7 +136,7 @@ background of 'evil-goggles-default-face, then 'region."
(numberp end)
;; don't show overlay if the region is a single char on a single line
(not (and (<= (- end beg) 1)
- (= (line-number-at-pos beg) (line-number-at-pos end))))
+ (<= (count-lines beg end) 1)))
(<= (point-min) beg end)
(>= (point-max) end beg)
(not (evil-visual-state-p))
@@ -415,7 +415,7 @@ BEG and END are the argumenets to the original functions."
(when (and (called-interactively-p 'interactive)
(evil-goggles--show-p beg end)
;; don't show goggles for single lines ("J"/"gJ" without count)
- (< 1 (- (line-number-at-pos end) (line-number-at-pos beg))))
+ (< 1 (count-lines beg end)))
(evil-goggles--show-blocking-hint beg end)))
;;; fill
- [nongnu] elpa/evil-goggles 9626b143e1 171/225: Always use `evaporate` overlay property, (continued)
- [nongnu] elpa/evil-goggles 9626b143e1 171/225: Always use `evaporate` overlay property, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 56691c6e65 132/225: Rename functions, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 48feeba6f0 180/225: Update README, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles bc318ad4b7 184/225: `require` pulse, rather than create an autoload for one of its functions, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 580b219de6 192/225: Add `S` hint, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 2739529221 198/225: Add hint for evil-replace-with-register, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 13bcbda8a4 195/225: Add hind for `C`, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles e89110cd92 206/225: Fix docstrings reported by `checkdoc`, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles d3ad932a1c 208/225: Merge branch 'use-before-advice', ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles dc0d65911e 209/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles d3222f8b07 219/225: speedup: count-lines instead of substracting line-number-at-pos's,
ELPA Syncer <=
- [nongnu] elpa/evil-goggles 1b66053ea5 225/225: Merge pull request #31 from skangas/bump-version, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 7801d9204c 224/225: Bump version to 0.0.2, ELPA Syncer, 2022/01/12