[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 61599a0 274/310: Change linear tune to search only
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 61599a0 274/310: Change linear tune to search only known measures and use it to |
Date: |
Sat, 28 Nov 2020 00:33:30 -0500 (EST) |
branch: externals/vlf
commit 61599a007f4bd7f82bb873deb3f4fd53066744fc
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Change linear tune to search only known measures and use it to
initialize occur indexing. Make default tune step smaller.
---
vlf-occur.el | 10 ++++++----
vlf-tune.el | 22 +++++++++-------------
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 224417e..73de8c2 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -149,6 +149,7 @@ EVENT may hold details of the invocation."
Prematurely ending indexing will still show what's found so far."
(let ((vlf-buffer (current-buffer))
(file buffer-file-name)
+ (file-size vlf-file-size)
(batch-size vlf-batch-size)
(is-hexl (derived-mode-p 'hexl-mode))
(insert-bps vlf-tune-insert-bps)
@@ -158,7 +159,8 @@ Prematurely ending indexing will still show what's found so
far."
(with-temp-buffer
(setq buffer-file-name file
buffer-file-truename file
- buffer-undo-list t)
+ buffer-undo-list t
+ vlf-file-size file-size)
(set-buffer-modified-p nil)
(set (make-local-variable 'vlf-batch-size) batch-size)
(when vlf-tune-enabled
@@ -167,8 +169,8 @@ Prematurely ending indexing will still show what's found so
far."
(if is-hexl
(progn (setq vlf-tune-hexl-bps hexl-bps
vlf-tune-insert-raw-bps insert-raw-bps)
- (vlf-tune-batch '(:hexl :raw)))
- (vlf-tune-batch '(:insert :encode))))
+ (vlf-tune-batch '(:hexl :raw) t))
+ (vlf-tune-batch '(:insert :encode) t)))
(vlf-mode 1)
(if is-hexl (hexl-mode))
(goto-char (point-min))
@@ -203,7 +205,7 @@ Prematurely ending indexing will still show what's found so
far."
(is-hexl (derived-mode-p 'hexl-mode)))
(vlf-tune-batch (if (derived-mode-p 'hexl-mode)
'(:hexl :raw)
- '(:insert :encode)))
+ '(:insert :encode)) t)
(vlf-with-undo-disabled
(vlf-move-to-batch 0)
(goto-char (point-min))
diff --git a/vlf-tune.el b/vlf-tune.el
index c2fe69a..ccbd56d 100644
--- a/vlf-tune.el
+++ b/vlf-tune.el
@@ -63,7 +63,7 @@ but don't change batch size. If t, measure and change."
"Maximum batch size in bytes when auto tuning."
:group 'vlf :type 'integer)
-(defcustom vlf-tune-step (/ vlf-tune-max 1000)
+(defcustom vlf-tune-step (/ vlf-tune-max 10000)
"Step used for tuning in bytes."
:group 'vlf :type 'integer)
@@ -339,22 +339,18 @@ MIN and MAX specify interval of indexes to search."
(setq vlf-batch-size (* (1+ left-idx) vlf-tune-step)))))))
(defun vlf-tune-linear (types max-idx)
- "Adjust `vlf-batch-size' to optimal value using linear search,\
-optimizing over TYPES up to MAX-IDX."
+ "Adjust `vlf-batch-size' to optimal known value using linear search.
+Optimize over TYPES up to MAX-IDX."
(let ((best-idx 0)
(best-bps 0)
- (idx 0)
- (none-missing t))
- (while (and none-missing (< idx max-idx))
+ (idx 0))
+ (while (< idx max-idx)
(let ((bps (vlf-tune-score types idx)))
- (cond ((null bps)
- (setq vlf-batch-size (* (1+ idx) vlf-tune-step)
- none-missing nil))
- ((< best-bps bps) (setq best-idx idx
- best-bps bps))))
+ (and bps (< best-bps bps)
+ (setq best-idx idx
+ best-bps bps)))
(setq idx (1+ idx)))
- (if none-missing
- (setq vlf-batch-size (* (1+ best-idx) vlf-tune-step)))))
+ (setq vlf-batch-size (* (1+ best-idx) vlf-tune-step))))
(defun vlf-tune-batch (types &optional linear file)
"Adjust `vlf-batch-size' to optimal value optimizing on TYPES.
- [elpa] externals/vlf 569e4b2 237/310: Don't ask needles questions on changing helm batch and restore undo, (continued)
- [elpa] externals/vlf 569e4b2 237/310: Don't ask needles questions on changing helm batch and restore undo, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1f9ba7c 230/310: Use derived-mode-p., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 32ff2cb 239/310: Add bookkeeping module., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5379943 242/310: Save times instead of speeds, compare on cumulative speed when tuning., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0d9cc8e 245/310: Don't measure encoding of too small region when adjusting chunk start, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e8bb4a9 248/310: Apply batch size tuning on adjacent moves, search, save adjusting and, Stefan Monnier, 2020/11/28
- [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 <=
- [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, 2020/11/28
- [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