mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-31 10:10:48 +00:00
Fix measure approximation and allow tuning to just over half file
batch.
This commit is contained in:
parent
48a014f3bc
commit
f3212ec9a6
20
vlf-tune.el
20
vlf-tune.el
@ -180,17 +180,14 @@ SIZE is number of bytes that are saved."
|
|||||||
(max (length vec)))
|
(max (length vec)))
|
||||||
(while (and (zerop val) (or (<= 0 left-idx)
|
(while (and (zerop val) (or (<= 0 left-idx)
|
||||||
(< right-idx max)))
|
(< right-idx max)))
|
||||||
(when (<= 0 left-idx)
|
(if (<= 0 left-idx)
|
||||||
(setq val (car (aref vec left-idx)))
|
(let ((left (car (aref vec left-idx))))
|
||||||
(if (and (not (zerop val)) (/= val -1))
|
(if (and (not (zerop left)) (/= left -1))
|
||||||
(setq val (/ (* val (1+ index))
|
(setq val left))))
|
||||||
(1+ left-idx)))))
|
|
||||||
(if (< right-idx max)
|
(if (< right-idx max)
|
||||||
(let ((right (car (aref vec left-idx))))
|
(let ((right (car (aref vec right-idx))))
|
||||||
(if (and (not (zerop right)) (/= right -1))
|
(if (and (not (zerop right)) (/= right -1))
|
||||||
(setq right (/ (* right (1+ index))
|
(setq val (if (zerop val)
|
||||||
(1+ right-idx))
|
|
||||||
val (if (zerop val)
|
|
||||||
right
|
right
|
||||||
(/ (+ val right) 2))))))
|
(/ (+ val right) 2))))))
|
||||||
(setq left-idx (1- left-idx)
|
(setq left-idx (1- left-idx)
|
||||||
@ -244,7 +241,7 @@ SIZE is number of bytes that are saved."
|
|||||||
"Adjust `vlf-batch-size' to best nearby value over TYPES.
|
"Adjust `vlf-batch-size' to best nearby value over TYPES.
|
||||||
INDEX if given, specifies search independent of current batch size."
|
INDEX if given, specifies search independent of current batch size."
|
||||||
(if (eq vlf-tune-enabled t)
|
(if (eq vlf-tune-enabled t)
|
||||||
(let* ((half-max (/ vlf-file-size 2))
|
(let* ((half-max (/ (1+ vlf-file-size) 2))
|
||||||
(idx (or index (vlf-tune-closest-index vlf-batch-size)))
|
(idx (or index (vlf-tune-closest-index vlf-batch-size)))
|
||||||
(curr (if (< half-max (* idx vlf-tune-step)) t
|
(curr (if (< half-max (* idx vlf-tune-step)) t
|
||||||
(vlf-tune-score types idx))))
|
(vlf-tune-score types idx))))
|
||||||
@ -321,7 +318,8 @@ non list values in which case coeficient is assumed 1.
|
|||||||
Types can be :insert, :raw, :encode, :write, :hexl or :dehexlify.
|
Types can be :insert, :raw, :encode, :write, :hexl or :dehexlify.
|
||||||
If LINEAR is non nil, use brute-force."
|
If LINEAR is non nil, use brute-force."
|
||||||
(if (eq vlf-tune-enabled t)
|
(if (eq vlf-tune-enabled t)
|
||||||
(let ((max-idx (1- (/ (min vlf-tune-max (/ vlf-file-size 2))
|
(let ((max-idx (1- (/ (min vlf-tune-max
|
||||||
|
(/ (1+ vlf-file-size) 2))
|
||||||
vlf-tune-step))))
|
vlf-tune-step))))
|
||||||
(cond (linear (vlf-tune-linear types max-idx))
|
(cond (linear (vlf-tune-linear types max-idx))
|
||||||
((file-remote-p buffer-file-name)
|
((file-remote-p buffer-file-name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user