[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 305d802 280/310: Use shared profiling info for enco
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 305d802 280/310: Use shared profiling info for encode, write and hexl operations. |
Date: |
Sat, 28 Nov 2020 00:33:32 -0500 (EST) |
branch: externals/vlf
commit 305d8022c43b8994a42b13478f596e653279f7e5
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Use shared profiling info for encode, write and hexl operations.
---
vlf-occur.el | 20 ++++++--------------
vlf-tune.el | 29 +++++++++++------------------
2 files changed, 17 insertions(+), 32 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 45ff3cc..74911a3 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -153,8 +153,6 @@ Prematurely ending indexing will still show what's found so
far."
(batch-size vlf-batch-size)
(is-hexl (derived-mode-p 'hexl-mode))
(insert-bps vlf-tune-insert-bps)
- (encode-bps vlf-tune-encode-bps)
- (hexl-bps vlf-tune-hexl-bps)
(insert-raw-bps vlf-tune-insert-raw-bps))
(with-temp-buffer
(setq buffer-file-name file
@@ -164,11 +162,9 @@ Prematurely ending indexing will still show what's found
so far."
(set-buffer-modified-p nil)
(set (make-local-variable 'vlf-batch-size) batch-size)
(when vlf-tune-enabled
- (setq vlf-tune-insert-bps insert-bps
- vlf-tune-encode-bps encode-bps)
+ (setq vlf-tune-insert-bps insert-bps)
(if is-hexl
- (progn (setq vlf-tune-hexl-bps hexl-bps
- vlf-tune-insert-raw-bps insert-raw-bps)
+ (progn (setq vlf-tune-insert-raw-bps insert-raw-bps)
(vlf-tune-batch '(:hexl :raw) t))
(vlf-tune-batch '(:insert :encode) t)))
(vlf-mode 1)
@@ -176,17 +172,13 @@ Prematurely ending indexing will still show what's found
so far."
(goto-char (point-min))
(vlf-build-occur regexp vlf-buffer)
(when vlf-tune-enabled
- (setq insert-bps vlf-tune-insert-bps
- encode-bps vlf-tune-encode-bps)
+ (setq insert-bps vlf-tune-insert-bps)
(if is-hexl
- (setq hexl-bps vlf-tune-hexl-bps
- insert-raw-bps vlf-tune-insert-raw-bps))))
+ (setq insert-raw-bps vlf-tune-insert-raw-bps))))
(when vlf-tune-enabled ;merge back tune measurements
- (setq vlf-tune-insert-bps insert-bps
- vlf-tune-encode-bps encode-bps)
+ (setq vlf-tune-insert-bps insert-bps)
(if is-hexl
- (setq vlf-tune-hexl-bps hexl-bps
- vlf-tune-insert-raw-bps insert-raw-bps)))))
+ (setq vlf-tune-insert-raw-bps insert-raw-bps)))))
(defun vlf-occur (regexp)
"Make whole file occur style index for REGEXP.
diff --git a/vlf-tune.el b/vlf-tune.el
index 99c59dd..a098461 100644
--- a/vlf-tune.el
+++ b/vlf-tune.el
@@ -60,11 +60,13 @@ but don't change batch size. If t, measure and change."
(if ram-size
(/ ram-size 20)
large-file-warning-threshold))
- "Maximum batch size in bytes when auto tuning."
+ "Maximum batch size in bytes when auto tuning.
+Avoid increasing this after opening file with VLF."
:group 'vlf :type 'integer)
(defcustom vlf-tune-step (/ vlf-tune-max 10000)
- "Step used for tuning in bytes."
+ "Step used for tuning in bytes.
+Avoid decreasing this after opening file with VLF."
:group 'vlf :type 'integer)
(defcustom vlf-tune-load-time 1.0
@@ -83,23 +85,15 @@ but don't change batch size. If t, measure and change."
(defvar vlf-tune-encode-bps nil
"Vector of bytes per second encode measurements.")
-(make-variable-buffer-local 'vlf-tune-encode-bps)
-(put 'vlf-tune-encode-bps 'permanent-local t)
(defvar vlf-tune-write-bps nil
"Vector of bytes per second write measurements.")
-(make-variable-buffer-local 'vlf-tune-write-bps)
-(put 'vlf-tune-write-bps 'permanent-local t)
(defvar vlf-tune-hexl-bps nil
"Vector of bytes per second hexlify measurements.")
-(make-variable-buffer-local 'vlf-tune-hexl-bps)
-(put 'vlf-tune-hexl-bps 'permanent-local t)
(defvar vlf-tune-dehexlify-bps nil
"Vector of bytes per second dehexlify measurements.")
-(make-variable-buffer-local 'vlf-tune-dehexlify-bps)
-(put 'vlf-tune-dehexlify-bps 'permanent-local t)
(defun vlf-tune-closest-index (size)
"Get closest measurement index corresponding to SIZE."
@@ -114,8 +108,6 @@ but don't change batch size. If t, measure and change."
(defun vlf-tune-initialize-measurement ()
"Initialize measurement vector."
- (make-local-variable 'vlf-tune-max)
- (make-local-variable 'vlf-tune-step)
(make-vector (1- (/ vlf-tune-max vlf-tune-step)) nil))
(defmacro vlf-tune-add-measurement (vec size time)
@@ -168,15 +160,16 @@ FILE if given is filename to be used, otherwise
`buffer-file-name'."
(cdr result) (car result))
(cdr result)))
-(defun vlf-tune-write (start end append visit size &optional file)
+(defun vlf-tune-write (start end append visit size &optional file-name)
"Save buffer and save time it takes.
START, END, APPEND, VISIT have same meaning as in `write-region'.
SIZE is number of bytes that are saved.
-FILE if given is filename to be used, otherwise `buffer-file-name'."
- (let ((time (car (vlf-time (write-region start end
- (or file buffer-file-name)
- append visit)))))
- (vlf-tune-add-measurement vlf-tune-write-bps size time)))
+FILE-NAME if given is to be used instead of `buffer-file-name'."
+ (let* ((file (or file-name buffer-file-name))
+ (time (car (vlf-time (write-region start end file append
+ visit)))))
+ (or (file-remote-p file) ;writing to remote files can include network
copying
+ (vlf-tune-add-measurement vlf-tune-write-bps size time))))
(defun vlf-tune-hexlify ()
"Activate `hexl-mode' and save time it takes."
- [elpa] externals/vlf e18a05b 247/310: Add linear search for tuning and prefer smaller batches., (continued)
- [elpa] externals/vlf e18a05b 247/310: Add linear search for tuning and prefer smaller batches., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 48a014f 250/310: Fix write measuring and endless loop in nearby approximation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ee7409b 254/310: Tune batch size in more cases., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5651ee3 252/310: Rename vlf-tune-optimal to vlf-tune-batch., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 06b4f85 262/310: Respect disabled tune settings and move custom options., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 199209f 263/310: Fix vlf-tune-optimal-load with no optional arguments supplied., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 023ee70 267/310: Declare hexl functions to please byte compiler., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c3a308c 271/310: Optimize save performance over the temp file if such is used. Add, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ce13609 278/310: Fix vlf-ediff at the borders of hexl buffers., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f43ada1 282/310: Fix byte compilation warnings., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 305d802 280/310: Use shared profiling info for encode, write and hexl operations.,
Stefan Monnier <=
- [elpa] externals/vlf 5dd9e2c 281/310: Adjust address parts of hexlified buffer according to vlf-start-pos., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 68d6c1b 289/310: vlf-occur changes:, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0fa6248 288/310: Optimize unconditional chunk loading and prefer it in more cases of, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf bd5f9ca 286/310: Back to using per buffer profiling for encode speed., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 726f50b 294/310: Fix byte-compilation warnings on install., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf eaa3629 299/310: Fix cursor position after search, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ac1aa16 296/310: Standard naming for chunk update hooks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf cc02f25 306/310: Fix typos, Stefan Monnier, 2020/11/28