[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 70a8107 243/310: Add vlf-batch-size tuning in vlf-o
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 70a8107 243/310: Add vlf-batch-size tuning in vlf-occur. |
Date: |
Sat, 28 Nov 2020 00:33:24 -0500 (EST) |
branch: externals/vlf
commit 70a81077ab7710ec7e97df7e0b9b062513660bcc
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Add vlf-batch-size tuning in vlf-occur.
---
vlf-occur.el | 53 +++++++++++++++++++++++++++++++----------------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 5ce1643..610f5b0 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -182,26 +182,31 @@ Prematurely ending indexing will still show what's found
so far."
(defun vlf-build-occur (regexp vlf-buffer)
"Build occur style index for REGEXP over VLF-BUFFER."
- (let ((tramp-verbose (if (boundp 'tramp-verbose)
- (min tramp-verbose 2)))
- (case-fold-search t)
- (line 1)
- (last-match-line 0)
- (last-line-pos (point-min))
- (total-matches 0)
- (match-end-pos (+ vlf-start-pos (position-bytes (point))))
- (occur-buffer (generate-new-buffer
- (concat "*VLF-occur " (file-name-nondirectory
- buffer-file-name)
- "*")))
- (line-regexp (concat "\\(?5:[\n\C-m]\\)\\|\\(?10:"
- regexp "\\)"))
- (batch-step (/ vlf-batch-size 8))
- (is-hexl (derived-mode-p 'hexl-mode))
- (end-of-file nil)
- (reporter (make-progress-reporter
- (concat "Building index for " regexp "...")
- vlf-start-pos vlf-file-size)))
+ (let* ((tramp-verbose (if (boundp 'tramp-verbose)
+ (min tramp-verbose 2)))
+ (case-fold-search t)
+ (line 1)
+ (last-match-line 0)
+ (last-line-pos (point-min))
+ (total-matches 0)
+ (match-end-pos (+ vlf-start-pos (position-bytes (point))))
+ (occur-buffer (generate-new-buffer
+ (concat "*VLF-occur " (file-name-nondirectory
+ buffer-file-name)
+ "*")))
+ (line-regexp (concat "\\(?5:[\n\C-m]\\)\\|\\(?10:"
+ regexp "\\)"))
+ (batch-step (min 1024 (/ vlf-batch-size 8)))
+ (is-hexl (derived-mode-p 'hexl-mode))
+ (end-of-file nil)
+ (time (float-time))
+ (tune-types (let ((base '(:insert :encode)))
+ (if is-hexl
+ (nconc '(:hexl :dehexlify) base)
+ base)))
+ (reporter (make-progress-reporter
+ (concat "Building index for " regexp "...")
+ vlf-start-pos vlf-file-size)))
(with-current-buffer occur-buffer
(setq buffer-undo-list t))
(unwind-protect
@@ -254,6 +259,7 @@ Prematurely ending indexing will still show what's found so
far."
total-matches))))))))
(setq end-of-file (= vlf-end-pos vlf-file-size))
(unless end-of-file
+ (vlf-tune-best tune-types)
(let ((batch-move (- vlf-end-pos batch-step)))
(vlf-move-to-batch (if (or is-hexl
(< match-end-pos
@@ -273,7 +279,8 @@ Prematurely ending indexing will still show what's found so
far."
(set-buffer-modified-p nil)
(if (zerop total-matches)
(progn (kill-buffer occur-buffer)
- (message "No matches for \"%s\"" regexp))
+ (message "No matches for \"%s\" (%f secs)"
+ regexp (- (float-time) time)))
(let ((file buffer-file-name)
(dir default-directory))
(with-current-buffer occur-buffer
@@ -291,7 +298,9 @@ in file: %s" total-matches line regexp file)
vlf-occur-regexp regexp
vlf-occur-hexl is-hexl
vlf-occur-lines line)))
- (display-buffer occur-buffer)))))
+ (display-buffer occur-buffer)
+ (message "Occur finished for \"%s\" (%f secs)"
+ regexp (- (float-time) time))))))
;; save, load vlf-occur data
- [elpa] externals/vlf 859c1e4 223/310: Fix hook names., (continued)
- [elpa] externals/vlf 859c1e4 223/310: Fix hook names., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 694d1de 235/310: Allow vlf-occur results be saved to file and later reused., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 274c5ab 233/310: Perform search, occur and ediff operations over hexl content instead, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d9cc6fb 264/310: Fix vlf-tune-optimal-load in case best value prunes slower times leaving, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d1a6800 284/310: Move vlf information from buffer name to the mode line., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a7be713 283/310: Set vlf-tune-max with proper value in case RAM size is wrongly, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf bc398d6 291/310: - don't adjust start on next occur batch, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a01e9ed 304/310: Minor README additions., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 31b292d 305/310: fixed large-file-warning-threshold error, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 63d23ac 309/310: Make vlf handle nil large-file-warning-threshold value, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 70a8107 243/310: Add vlf-batch-size tuning in vlf-occur.,
Stefan Monnier <=
- [elpa] externals/vlf f3212ec 251/310: Fix measure approximation and allow tuning to just over half file, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 11c7af4 253/310: Change handling of measurement values to support approximations., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 35ede94 255/310: Restore batch size after save with adjustment., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ff06509 261/310: Document tune functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1c961f4 285/310: Fix whole file reload in read-only buffer on vlf-mode exit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4526a1 287/310: Forbid short-cutting in line search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fd90b3a 295/310: Use xdigit regex class in vlf-hexl-adjust-addresses., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf df677c1 302/310: Issue 35: make mode-line batch indicators more accurate, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a568d2d 307/310: packages/vlf: Update copyright dates and bump version., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0ecb40a 124/310: Keep as much editing as possible when moving to intersecting chunk., Stefan Monnier, 2020/11/28