mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-18 20:10:47 +00:00
Copy around buffer specific profile vectors when forking new buffers.
This commit is contained in:
parent
68d6c1bc33
commit
b14c912afb
26
vlf-occur.el
26
vlf-occur.el
@ -127,7 +127,10 @@ EVENT may hold details of the invocation."
|
|||||||
(match-pos (+ (get-text-property pos 'line-pos)
|
(match-pos (+ (get-text-property pos 'line-pos)
|
||||||
pos-relative)))
|
pos-relative)))
|
||||||
(cond (current-prefix-arg
|
(cond (current-prefix-arg
|
||||||
|
(let ((original-occur-buffer vlf-occur-vlf-buffer))
|
||||||
(setq vlf-buffer (vlf file t))
|
(setq vlf-buffer (vlf file t))
|
||||||
|
(if (buffer-live-p original-occur-buffer)
|
||||||
|
(vlf-tune-copy-profile original-occur-buffer)))
|
||||||
(or not-hexl (hexl-mode))
|
(or not-hexl (hexl-mode))
|
||||||
(switch-to-buffer occur-buffer))
|
(switch-to-buffer occur-buffer))
|
||||||
((not (buffer-live-p vlf-buffer))
|
((not (buffer-live-p vlf-buffer))
|
||||||
@ -155,9 +158,7 @@ Prematurely ending indexing will still show what's found so far."
|
|||||||
(file buffer-file-name)
|
(file buffer-file-name)
|
||||||
(file-size vlf-file-size)
|
(file-size vlf-file-size)
|
||||||
(batch-size vlf-batch-size)
|
(batch-size vlf-batch-size)
|
||||||
(is-hexl (derived-mode-p 'hexl-mode))
|
(is-hexl (derived-mode-p 'hexl-mode)))
|
||||||
(insert-bps vlf-tune-insert-bps)
|
|
||||||
(insert-raw-bps vlf-tune-insert-raw-bps))
|
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(setq buffer-file-name file
|
(setq buffer-file-name file
|
||||||
buffer-file-truename file
|
buffer-file-truename file
|
||||||
@ -166,23 +167,16 @@ Prematurely ending indexing will still show what's found so far."
|
|||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
(set (make-local-variable 'vlf-batch-size) batch-size)
|
(set (make-local-variable 'vlf-batch-size) batch-size)
|
||||||
(when vlf-tune-enabled
|
(when vlf-tune-enabled
|
||||||
(setq vlf-tune-insert-bps insert-bps)
|
(vlf-tune-copy-profile vlf-buffer)
|
||||||
(if is-hexl
|
(vlf-tune-batch (if is-hexl
|
||||||
(progn (setq vlf-tune-insert-raw-bps insert-raw-bps)
|
'(:hexl :raw)
|
||||||
(vlf-tune-batch '(:hexl :raw) t))
|
'(:insert :encode)) t))
|
||||||
(vlf-tune-batch '(:insert :encode) t)))
|
|
||||||
(vlf-mode 1)
|
(vlf-mode 1)
|
||||||
(if is-hexl (hexl-mode))
|
(if is-hexl (hexl-mode))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(vlf-build-occur regexp vlf-buffer)
|
(vlf-build-occur regexp vlf-buffer)
|
||||||
(when vlf-tune-enabled
|
(if vlf-tune-enabled
|
||||||
(setq insert-bps vlf-tune-insert-bps)
|
(vlf-tune-copy-profile (current-buffer) vlf-buffer)))))
|
||||||
(if is-hexl
|
|
||||||
(setq insert-raw-bps vlf-tune-insert-raw-bps))))
|
|
||||||
(when vlf-tune-enabled ;merge back tune measurements
|
|
||||||
(setq vlf-tune-insert-bps insert-bps)
|
|
||||||
(if is-hexl
|
|
||||||
(setq vlf-tune-insert-raw-bps insert-raw-bps)))))
|
|
||||||
|
|
||||||
(defun vlf-occur (regexp)
|
(defun vlf-occur (regexp)
|
||||||
"Make whole file occur style index for REGEXP.
|
"Make whole file occur style index for REGEXP.
|
||||||
|
18
vlf-tune.el
18
vlf-tune.el
@ -98,11 +98,29 @@ Avoid decreasing this after opening file with VLF."
|
|||||||
(defvar vlf-tune-dehexlify-bps nil
|
(defvar vlf-tune-dehexlify-bps nil
|
||||||
"Vector of bytes per second dehexlify measurements.")
|
"Vector of bytes per second dehexlify measurements.")
|
||||||
|
|
||||||
|
(defvar vlf-start-pos)
|
||||||
(defvar hexl-bits)
|
(defvar hexl-bits)
|
||||||
(defvar hexl-max-address)
|
(defvar hexl-max-address)
|
||||||
(declare-function hexl-line-displen "hexl")
|
(declare-function hexl-line-displen "hexl")
|
||||||
(declare-function dehexlify-buffer "hexl")
|
(declare-function dehexlify-buffer "hexl")
|
||||||
|
|
||||||
|
(defun vlf-tune-copy-profile (from-buffer &optional to-buffer)
|
||||||
|
"Copy specific profile vectors of FROM-BUFFER to TO-BUFFER.
|
||||||
|
If TO-BUFFER is nil, copy to current buffer."
|
||||||
|
(let (insert-bps insert-raw-bps encode-bps)
|
||||||
|
(with-current-buffer from-buffer
|
||||||
|
(setq insert-bps vlf-tune-insert-bps
|
||||||
|
insert-raw-bps vlf-tune-insert-raw-bps
|
||||||
|
encode-bps vlf-tune-encode-bps))
|
||||||
|
(if to-buffer
|
||||||
|
(with-current-buffer to-buffer
|
||||||
|
(setq vlf-tune-insert-bps insert-bps
|
||||||
|
vlf-tune-insert-raw-bps insert-raw-bps
|
||||||
|
vlf-tune-encode-bps encode-bps))
|
||||||
|
(setq vlf-tune-insert-bps insert-bps
|
||||||
|
vlf-tune-insert-raw-bps insert-raw-bps
|
||||||
|
vlf-tune-encode-bps encode-bps))))
|
||||||
|
|
||||||
(defun vlf-tune-closest-index (size)
|
(defun vlf-tune-closest-index (size)
|
||||||
"Get closest measurement index corresponding to SIZE."
|
"Get closest measurement index corresponding to SIZE."
|
||||||
(let ((step (float vlf-tune-step)))
|
(let ((step (float vlf-tune-step)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user