mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-18 12:05:31 +00:00
Add function to linearly search best batch size according to existing
measurements and offer it when interactively changing batch size.
This commit is contained in:
parent
35ede9403c
commit
9271f68c05
15
vlf-tune.el
15
vlf-tune.el
@ -345,6 +345,21 @@ Suitable for multiple batch operations."
|
||||
(vlf-tune-conservative types (/ max-idx 2))
|
||||
(vlf-tune-binary types 0 max-idx)))))))
|
||||
|
||||
(defun vlf-tune-get-optimal (types)
|
||||
"Get best batch size according to existing measurements over TYPES."
|
||||
(let ((max-idx (1- (/ (min vlf-tune-max (/ (1+ vlf-file-size) 2))
|
||||
vlf-tune-step)))
|
||||
(best-idx 0)
|
||||
(best-bps 0)
|
||||
(idx 0))
|
||||
(while (< idx max-idx)
|
||||
(let ((bps (vlf-tune-score types idx t)))
|
||||
(and bps (< best-bps bps)
|
||||
(setq best-idx idx
|
||||
best-bps bps)))
|
||||
(setq idx (1+ idx)))
|
||||
(* (1+ best-idx) vlf-tune-step)))
|
||||
|
||||
(provide 'vlf-tune)
|
||||
|
||||
;;; vlf-tune.el ends here
|
||||
|
7
vlf.el
7
vlf.el
@ -259,7 +259,12 @@ with the prefix argument DECREASE it is halved."
|
||||
|
||||
(defun vlf-set-batch-size (size)
|
||||
"Set batch to SIZE bytes and update chunk."
|
||||
(interactive (list (read-number "Size in bytes: " vlf-batch-size)))
|
||||
(interactive
|
||||
(list (read-number "Size in bytes: "
|
||||
(vlf-tune-get-optimal
|
||||
(if (derived-mode-p 'hexl-mode)
|
||||
'(:hexl :dehexlify :insert :encode)
|
||||
'(:insert :encode))))))
|
||||
(setq vlf-batch-size size)
|
||||
(vlf-move-to-batch vlf-start-pos))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user