[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 7b9befe 275/310: - don't load unnecessary data at t
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 7b9befe 275/310: - don't load unnecessary data at the end of search or occur |
Date: |
Sat, 28 Nov 2020 00:33:31 -0500 (EST) |
branch: externals/vlf
commit 7b9befe81a13301d1bde553c60f23d1fb75f73c1
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
- don't load unnecessary data at the end of search or occur
- don't flood profile vector with approximations in linear search
---
vlf-occur.el | 13 +++++++------
vlf-search.el | 37 +++++++++++++++++++++----------------
vlf-tune.el | 4 ++--
3 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 73de8c2..4694655 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -294,12 +294,13 @@ Prematurely ending indexing will still show what's found
so far."
(setq end-of-file (= vlf-end-pos vlf-file-size))
(unless end-of-file
(vlf-tune-batch tune-types)
- (let ((batch-move (- vlf-end-pos batch-step)))
- (vlf-move-to-batch (if (or is-hexl
- (< match-end-pos
- batch-move))
- batch-move
- match-end-pos) t))
+ (let* ((batch-move (- vlf-end-pos batch-step))
+ (start (if (or is-hexl (< match-end-pos
+ batch-move))
+ batch-move
+ match-end-pos)))
+ (vlf-move-to-chunk start (+ start
+ vlf-batch-size) t))
(goto-char (if (or is-hexl
(<= match-end-pos vlf-start-pos))
(point-min)
diff --git a/vlf-search.el b/vlf-search.el
index 5be45b7..c60e631 100644
--- a/vlf-search.el
+++ b/vlf-search.el
@@ -79,14 +79,15 @@ Return t if search has been at least partially successful."
((zerop vlf-start-pos)
(throw 'end-of-file nil))
(t (vlf-tune-batch tune-types)
- (let ((batch-move (- vlf-start-pos
- (- vlf-batch-size
- batch-step))))
- (vlf-move-to-batch
- (if (or is-hexl
- (<= batch-move match-start-pos))
- batch-move
- (- match-start-pos vlf-batch-size)) t))
+ (let* ((batch-move (+ vlf-start-pos
+ batch-step))
+ (end (if (or is-hexl
+ (<= batch-move
+ match-start-pos))
+ batch-move
+ match-start-pos)))
+ (vlf-move-to-chunk (- end vlf-batch-size)
+ end t))
(goto-char (if (or is-hexl
(<= vlf-end-pos
match-start-pos))
@@ -110,17 +111,21 @@ Return t if search has been at least partially
successful."
match-end-pos (+ vlf-start-pos
(position-bytes
(match-end 0))))))
- ((= vlf-end-pos vlf-file-size)
+ ((>= vlf-end-pos vlf-file-size)
(throw 'end-of-file nil))
(t (vlf-tune-batch tune-types)
- (let ((batch-move (- vlf-end-pos batch-step)))
- (vlf-move-to-batch
- (if (or is-hexl
- (< match-end-pos batch-move))
- batch-move
- match-end-pos) t))
+ (let* ((batch-move (- vlf-end-pos batch-step))
+ (start (if (or is-hexl
+ (< match-end-pos
+ batch-move))
+ batch-move
+ match-end-pos)))
+ (vlf-move-to-chunk start
+ (+ start vlf-batch-size)
+ t))
(goto-char (if (or is-hexl
- (<= match-end-pos vlf-start-pos))
+ (<= match-end-pos
+ vlf-start-pos))
(point-min)
(or (byte-to-position
(- match-end-pos
diff --git a/vlf-tune.el b/vlf-tune.el
index ccbd56d..08bdd9d 100644
--- a/vlf-tune.el
+++ b/vlf-tune.el
@@ -116,7 +116,7 @@ but don't change batch size. If t, measure and change."
"Initialize measurement vector."
(make-local-variable 'vlf-tune-max)
(make-local-variable 'vlf-tune-step)
- (make-vector (/ vlf-tune-max vlf-tune-step) nil))
+ (make-vector (1- (/ vlf-tune-max vlf-tune-step)) nil))
(defmacro vlf-tune-add-measurement (vec size time)
"Add at an appropriate position in VEC new SIZE TIME measurement.
@@ -345,7 +345,7 @@ Optimize over TYPES up to MAX-IDX."
(best-bps 0)
(idx 0))
(while (< idx max-idx)
- (let ((bps (vlf-tune-score types idx)))
+ (let ((bps (vlf-tune-score types idx t)))
(and bps (< best-bps bps)
(setq best-idx idx
best-bps bps)))
- [elpa] externals/vlf d526ea8 257/310: Apply and restore batch size in more cases., (continued)
- [elpa] externals/vlf d526ea8 257/310: Apply and restore batch size in more cases., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9b6657b 260/310: Replace usage of conservative tune in single batch operations with load, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2c660b0 269/310: Fix positive goto-line search and make highlighting of match optional., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3cfa9b1 273/310: Refactor vlf-query-replace and don't adjust batch size if only, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 61599a0 274/310: Change linear tune to search only known measures and use it to, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a9c14e2 268/310: Add regexp query replace over whole file command., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 673ae08 277/310: Lower tramp verbosity level., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ac8d400 276/310: Fixes to hexl-mode activation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f63ea96 272/310: Document new query replace and save options., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e4a2e80 266/310: Optimize goto-line for hexl-mode, no need to search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 7b9befe 275/310: - don't load unnecessary data at the end of search or occur,
Stefan Monnier <=
- [elpa] externals/vlf 842569a 270/310: Add ability to use temporary file when adjusting content on save., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d579b7b 279/310: Workaround local maximum in batch tune., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b14c912 290/310: Copy around buffer specific profile vectors when forking new buffers., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b300137 292/310: Encode smaller region to detect cut point overall offset in vlf-occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 86be483 293/310: Improve search precision., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a8ba836 298/310: Fix issue where tramp-verbose is bound to nil., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 25e16ef 303/310: Fix broken link in README, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b62bc04 301/310: Issue 31 Make vlf-batch-size configurable in the remote case, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 55e0c40 300/310: Explicitly set coding-system-for-read to the current coding when not, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4eaf763 297/310: Rename vlf-integrate.el to vlf-setup.el, Stefan Monnier, 2020/11/28