mirror of
https://github.com/m00natic/vlfi.git
synced 2025-04-18 16:50:19 +01:00
Fix access to uninitialized measurements when tuning.
This commit is contained in:
parent
0d9cc8e488
commit
d85f3d43fc
28
vlf-tune.el
28
vlf-tune.el
@ -164,24 +164,34 @@ SIZE is number of bytes that are saved."
|
|||||||
|
|
||||||
(defun vlf-tune-assess (type coef index)
|
(defun vlf-tune-assess (type coef index)
|
||||||
"Get measurement value according to TYPE, COEF and INDEX."
|
"Get measurement value according to TYPE, COEF and INDEX."
|
||||||
(* coef (cond ((eq type :insert)
|
(* coef (or (cond ((eq type :insert)
|
||||||
(car (aref vlf-tune-insert-bps index)))
|
(if vlf-tune-insert-bps
|
||||||
|
(car (aref vlf-tune-insert-bps index))))
|
||||||
((eq type :raw)
|
((eq type :raw)
|
||||||
(car (aref vlf-tune-insert-raw-bps index)))
|
(if vlf-tune-insert-raw-bps
|
||||||
|
(car (aref vlf-tune-insert-raw-bps index))))
|
||||||
((eq type :encode) ;encode size is less than batch size
|
((eq type :encode) ;encode size is less than batch size
|
||||||
|
(if vlf-tune-encode-bps
|
||||||
(let ((closest-idx index)
|
(let ((closest-idx index)
|
||||||
(val (car (aref vlf-tune-encode-bps index))))
|
(val (car (aref vlf-tune-encode-bps
|
||||||
(while (and (zerop val) (not (zerop closest-idx)))
|
index))))
|
||||||
|
(while (and (zerop val)
|
||||||
|
(not (zerop closest-idx)))
|
||||||
(setq closest-idx (1- closest-idx)
|
(setq closest-idx (1- closest-idx)
|
||||||
val (car (aref vlf-tune-encode-bps
|
val (car (aref vlf-tune-encode-bps
|
||||||
closest-idx))))
|
closest-idx))))
|
||||||
(/ (* val (1+ index)) (1+ closest-idx)))) ;approximate
|
(/ (* val (1+ index)) ;approximate
|
||||||
|
(1+ closest-idx)))))
|
||||||
((eq type :write)
|
((eq type :write)
|
||||||
(car (aref vlf-tune-write-bps index)))
|
(if vlf-tune-write-bps
|
||||||
|
(car (aref vlf-tune-write-bps index))))
|
||||||
((eq type :hexl)
|
((eq type :hexl)
|
||||||
(car (aref vlf-tune-hexl-bps index)))
|
(if vlf-tune-hexl-bps
|
||||||
|
(car (aref vlf-tune-hexl-bps index))))
|
||||||
((eq type :dehexlify)
|
((eq type :dehexlify)
|
||||||
(car (aref vlf-tune-dehexlify-bps index))))))
|
(if vlf-tune-dehexlify-bps
|
||||||
|
(car (aref vlf-tune-dehexlify-bps index)))))
|
||||||
|
0)))
|
||||||
|
|
||||||
(defun vlf-tune-score (types index)
|
(defun vlf-tune-score (types index)
|
||||||
"Cumulative speed over TYPES which is alist of (type coef) for INDEX."
|
"Cumulative speed over TYPES which is alist of (type coef) for INDEX."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user