[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 5379943 242/310: Save times instead of speeds, comp
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 5379943 242/310: Save times instead of speeds, compare on cumulative speed when tuning. |
Date: |
Sat, 28 Nov 2020 00:33:24 -0500 (EST) |
branch: externals/vlf
commit 5379943cd783ee3f2b2a1742a663d3ee58080de7
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Save times instead of speeds, compare on cumulative speed when tuning.
---
vlf-tune.el | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/vlf-tune.el b/vlf-tune.el
index fb4300d..2c8f677 100644
--- a/vlf-tune.el
+++ b/vlf-tune.el
@@ -107,7 +107,9 @@ VEC is a vector of (mean time . count) elements ordered by
size."
(existing (aref ,vec idx)))
(aset ,vec idx (let ((count (1+ (cdr existing)))) ;recalculate mean
(cons (/ (+ (* (1- count) (car existing))
- (/ ,size ,time))
+ (/ (* ,time (1+ idx) ;aproximate time
+ vlf-tune-step) ;for this size
+ ,size))
count)
count))))))
@@ -165,27 +167,29 @@ SIZE is number of bytes that are saved."
(defun vlf-tune-assess (type coef index)
"Get measurement value according to TYPE, COEF and INDEX."
(* coef (cond ((eq type :insert)
- (aref vlf-tune-insert-bps index))
+ (car (aref vlf-tune-insert-bps index)))
((eq type :raw)
- (aref vlf-tune-insert-raw-bps index))
+ (car (aref vlf-tune-insert-raw-bps index)))
((eq type :encode) ;encode size is less than batch size
- (let ((val (aref vlf-tune-encode-bps index)))
- (while (and (null val) (< 0 index)) ;find smaller index
- (setq index (1- index)
- val (aref vlf-tune-encode-bps index)))
- val))
+ (let ((closest-idx index)
+ (val (car (aref vlf-tune-encode-bps index))))
+ (while (and (zerop val) (not (zerop closest-idx)))
+ (setq closest-idx (1- closest-idx)
+ val (car (aref vlf-tune-encode-bps
+ closest-idx))))
+ (/ (* val (1+ index)) (1+ closest-idx)))) ;approximate
((eq type :write)
- (aref vlf-tune-write-bps index))
+ (car (aref vlf-tune-write-bps index)))
((eq type :hexl)
- (aref vlf-tune-hexl-bps index))
+ (car (aref vlf-tune-hexl-bps index)))
((eq type :dehexlify)
- (aref vlf-tune-dehexlify-bps index)))))
+ (car (aref vlf-tune-dehexlify-bps index))))))
(defun vlf-tune-score (types index)
- "Get score of TYPES which is alist of (type coef) for INDEX."
+ "Cumulative speed over TYPES which is alist of (type coef) for INDEX."
(catch 'result
(let ((score 0))
- (dolist (el types score)
+ (dolist (el types (/ (* (1+ index) vlf-tune-step) score))
(let ((sc (if (consp el)
(vlf-tune-assess (car el) (cadr el) index)
(vlf-tune-assess el 1 index))))
@@ -231,7 +235,7 @@ INDEX if given, specifies search independent of current
batch size."
vlf-tune-step))))))))))))
(defun vlf-tune-best (types &optional min max)
- "Adjust `vlf-batch-size' to optional value.
+ "Adjust `vlf-batch-size' to optional value with binary search.
Score is calculated over TYPES which is alist of form (type coef).
MIN and MAX may specify interval of indexes to search."
(if (eq vlf-tune-enabled t)
@@ -243,11 +247,11 @@ MIN and MAX may specify interval of indexes to search."
vlf-tune-step))))
(if (< (- max min) 3)
(vlf-tune-conservative types (round (+ min max) 2))
- (let* ((right-idx (+ min (round (* 2 (- max min)) 3)))
+ (let* ((right-idx (round (+ min (* 3 max)) 4))
(right (vlf-tune-score types right-idx)))
(if (null right)
(setq vlf-batch-size (* (1+ right-idx) vlf-tune-step))
- (let* ((left-idx (+ min (round (- max min) 3)))
+ (let* ((left-idx (round (+ (* 3 min) max) 4))
(left (vlf-tune-score types left-idx)))
(cond ((null left)
(setq vlf-batch-size (* (1+ left-idx)
- [elpa] externals/vlf 0fa8e8d 210/310: Update buffer name on user interruption during ediff., (continued)
- [elpa] externals/vlf 0fa8e8d 210/310: Update buffer name on user interruption during ediff., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 30d2bb0 208/310: VLF buffer ediff now starts from the current chunks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f83a212 213/310: Temporarily disable font-lock during multiple batch operations., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 074f9e9 221/310: Play nicely with hexl-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8c61b77 222/310: Fix when batch hooks are run for occur and save., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 6476c1b 227/310: Update README, wording, add links and information on hooks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8ba5bea 229/310: Don't run vlf-after-batch-functions hook in vlf-build-occur., Stefan Monnier, 2020/11/28
- [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 <=
- [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, 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