;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301\302\303\304\305\306\307&\210\310\311\312\313\314DD\315\306\301\316\317&\210\320\311\321\322#\210\310\323\312\313\324DD\325\306\301\316\326&\207" [custom-declare-group vlf nil "View Large Files in Emacs." :prefix "vlf-" :group files custom-declare-variable vlf-batch-size funcall function #[0 "\300\207" [1000000] 1] "Defines how large each batch of file data initially is (in bytes)." :type integer put permanent-local t vlf-tune-enabled #[0 "\300\207" [t] 1] "Whether to allow automatic change of batch size.\nIf nil, completely disable. If `stats', maintain measure statistics,\nbut don't change batch size. If t, measure and change." (choice (const :tag "Enabled" t) (const :tag "Just statistics" stats) (const :tag "Disabled" nil))] 8) #@40 Total size in bytes of presented file. (defvar vlf-file-size 0 (#$ . 1174)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local vlf-file-size put permanent-local t] 4) #@37 Try to determine RAM size in bytes. (defalias 'vlf-tune-ram-size #[0 "\300\301!\205\302\301!\303\304\"\211\205\305\306\225O!\307_\266\202\207" [executable-find "free" shell-command-to-string string-match "[[:digit:]]+" string-to-number 0 1000] 6 (#$ . 1372)]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\210\300\312\302\303\313DD\314\306\307\310\311&\210\300\315\302\303\316DD\317\306\307\310\320&\207" [custom-declare-variable vlf-tune-max funcall function #[0 "\301 \211\203\f\211\302\245\202 \303\262\206\304\300\305N@!]\207" [large-file-warning-threshold vlf-tune-ram-size 20 0 eval standard-value] 4] "Maximum batch size in bytes when auto tuning.\nAvoid increasing this after opening file with VLF." :group vlf :type integer vlf-tune-step #[0 "\301\245\207" [vlf-tune-max 10000] 2] "Step used for tuning in bytes.\nAvoid decreasing this after opening file with VLF." vlf-tune-load-time #[0 "\300\207" [1.0] 1] "How many seconds should batch take to load for best user experience." float] 8) #@49 Vector of bytes per second insert measurements. (defvar vlf-tune-insert-bps nil (#$ . 2404)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local vlf-tune-insert-bps put permanent-local t] 4) #@60 Vector of bytes per second non-decode insert measurements. (defvar vlf-tune-insert-raw-bps nil (#$ . 2625)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local vlf-tune-insert-raw-bps put permanent-local t] 4) #@49 Vector of bytes per second encode measurements. (defvar vlf-tune-encode-bps nil (#$ . 2865)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local vlf-tune-encode-bps put permanent-local t] 4) #@48 Vector of bytes per second write measurements. (defvar vlf-tune-write-bps nil (#$ . 3086)) #@50 Vector of bytes per second hexlify measurements. (defvar vlf-tune-hexl-bps nil (#$ . 3183)) #@52 Vector of bytes per second dehexlify measurements. (defvar vlf-tune-dehexlify-bps nil (#$ . 3281)) #@143 Copy specific profile vectors of FROM-BUFFER to TO-BUFFER. If TO-BUFFER is nil, copy to current buffer. (fn FROM-BUFFER &optional TO-BUFFER) (defalias 'vlf-tune-copy-profile #[513 "\303\211\211rq\210\262 \262\n\262)\203$rq\210\211\211)\202+\211\211\207" [vlf-tune-insert-bps vlf-tune-insert-raw-bps vlf-tune-encode-bps nil] 7 (#$ . 3387)]) #@65 Get closest measurement index corresponding to SIZE. (fn SIZE) (defalias 'vlf-tune-closest-index #[257 "\302!\303\304\"\304 \"^S]\207" [vlf-tune-step vlf-tune-max float 0 round] 7 (#$ . 3753)]) #@32 Initialize measurement vector. (defalias 'vlf-tune-initialize-measurement #[0 "\302 \245S\303\"\207" [vlf-tune-max vlf-tune-step make-vector nil] 3 (#$ . 3958)]) #@151 Add at an appropriate position in VEC new SIZE TIME measurement. VEC is a vector of (mean time . count) elements ordered by size. (fn VEC SIZE TIME) (defalias 'vlf-tune-add-measurement '(macro . #[771 "\300\301\302\303\304DDE\305\306\307BBE\310\311\312DD\313\314 \315BBDD\316\311\317\320\321\322\323\324\325\326\324EE\327BB\330BBE\323\324E\331BBFFEF\207" [when and vlf-tune-enabled not zerop or setq ((vlf-tune-initialize-measurement)) let* idx vlf-tune-closest-index existing aref (idx) aset if (consp existing) let ((count (1+ (cdr existing)))) cons / + (* (1- count) (car existing)) (count) (count) (1)] 22 (#$ . 4128)])) #@67 Get timing consed with result of BODY execution. (fn &rest BODY) (defalias 'vlf-time '(macro . #[128 "\300\301\302\303\304\305BDD\306BB\307\304\305BDC\310BBF\207" [if vlf-tune-enabled let* (time (float-time)) result progn ((cons (- (float-time) time) result)) let ((cons nil result))] 8 (#$ . 4778)])) #@81 Extract decoded file bytes START to END and save time it takes. (fn START END) (defalias 'vlf-tune-insert-file-contents #[514 "\203\303 \304 \305$\303 ZB\266\202\202\"\304 \305$\305B\262\203kZ\306U\204k\n\2045\307 \310Z!\nH\n:\203_AT\211S@_ Z@\245\\\245B\262\202hZ@\245\311BI\266\211A\207" [vlf-tune-enabled buffer-file-name vlf-tune-insert-bps float-time insert-file-contents nil 0 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 11 (#$ . 5091)]) #@159 Insert raw file bytes START to END and save time it takes. FILE if given is filename to be used, otherwise `buffer-file-name'. (fn START END &optional FILE) (defalias 'vlf-tune-insert-file-contents-literally #[770 "\203\303 \304\206\f \305$\303 ZB\266\202\202,\304\206# \305$\305B\262\203vZ\306U\204v\n\204?\307 \310Z!\nH\n:\203iAT\211S@_\nZ@\245\\\245B\262\202sZ@\245\311BI\266\211A\207" [vlf-tune-enabled buffer-file-name vlf-tune-insert-raw-bps float-time insert-file-contents-literally nil 0 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 12 (#$ . 5598)]) #@83 Get length of encoded region START to END and save time it takes. (fn START END) (defalias 'vlf-tune-encode-length #[514 "\203\303 \304 \305$G\303 ZB\266\202\202$\304 \305$G\306B\262\203g\211A\307U\204g\n\2046\310 \311A!\nH\n:\203]AT\211S@_A@\245\\\245B\262\202dA@\245\312BI\266\211A\207" [vlf-tune-enabled buffer-file-coding-system vlf-tune-encode-bps float-time encode-coding-region t nil 0 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 11 (#$ . 6224)]) #@261 Save buffer and save time it takes. START, END, APPEND, VISIT have same meaning as in `write-region'. SIZE is number of bytes that are saved. FILE-NAME if given is to be used instead of `buffer-file-name'. (fn START END APPEND VISIT SIZE &optional FILE-NAME) (defalias 'vlf-tune-write #[1541 "\211\206 \203!\303 \304  %\303 ZB\266\202\2021\304%\305B\262@\306!\206w \205w\307U?\205w\n\204J\310 \311!\nH\n:\203nAT\211S@_ \245\\\245B\262\202t\245\312BI\266\202\207" [buffer-file-name vlf-tune-enabled vlf-tune-write-bps float-time write-region nil file-remote-p 0 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 16 (#$ . 6735)]) #@62 Adjust hexl address indicators according to `vlf-start-pos'. (defalias 'vlf-hexl-adjust-addresses #[0 "`eb\210\302\303\304\305#\203\306\307\310\"!\210\211 \\\262\202b\207" [vlf-start-pos hexl-bits re-search-forward "^[[:xdigit:]]+" nil t replace-match format "%08x"] 6 (#$ . 7427)]) #@46 Activate `hexl-mode' and save time it takes. (defalias 'vlf-tune-hexlify #[0 "\304U \203\305 \306 \210\206\307 \305 ZB\266\202\202+\306 \210\211\206&\307 \310B\262@\311 S\312 \245\313_\314\\\206x \205x\n\304U?\205x \204M\315 \316\n! H :\203pAT\211S@_\n\245\\\245B\262\202u\n\245\317BI\266\202\207" [vlf-start-pos vlf-tune-enabled hexl-max-address vlf-tune-hexl-bps 0 float-time hexlify-buffer vlf-hexl-adjust-addresses nil buffer-size hexl-line-displen 16 15 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 10 (#$ . 7724)]) #@42 Exit `hexl-mode' and save time it takes. (defalias 'vlf-tune-dehexlify #[0 "\203\303 \304 \303 ZB\266\202\202\304 \305B\262@\205X \306U?\205X\n\204-\307 \310 !\nH\n:\203PAT\211S@_ \245\\\245B\262\202U \245\311BI\266\202\207" [vlf-tune-enabled hexl-max-address vlf-tune-dehexlify-bps float-time dehexlify-buffer nil 0 vlf-tune-initialize-measurement vlf-tune-closest-index 1] 9 (#$ . 8296)]) #@76 VEC has value for INDEX, approximate to closest available. (fn VEC INDEX) (defalias 'vlf-tune-approximate-nearby #[514 "\303ST\303\304Z]\305\\ T\306\245^\n\245S^\303U\203\203X\204)W\203\203X\203HH\211:\203?\211@\262\202G\211\247\203G\211\262\210W\203xH\211:\203[\211@\262\211\247\203w\211\303U\204w\303U\203p\211\202u\\\306\245\262\210S\262T\262\202\207" [vlf-tune-max vlf-file-size vlf-tune-step 0 5 6 2] 10 (#$ . 8720)]) #@153 Get value from VEC for INDEX. If missing, approximate from nearby measurement, unless DONT-APPROXIMATE is t. (fn VEC INDEX &optional DONT-APPROXIMATE) (defalias 'vlf-tune-get-value '(macro . #[770 "\300\301\302\303EDC\304\305\306\203 \307\n\n\310BBB\202&\311\n\nED\312\203<\307  \311EF\202B\311  ED\313BBBBE\314BBB\207" [if let val aref cond ((consp val) (car val)) (null val) aset (0) vlf-tune-approximate-nearby (zerop val) ((t val)) (most-positive-fixnum)] 17 (#$ . 9198)])) #@53 Get vlf-tune vector corresponding to KEY. (fn KEY) (defalias 'vlf-tune-get-vector '(macro . #[257 "\300\301\302BB\303B\301\304BB\305B\301\306BB\307B\301\310BB\311B\301\312BB\313B\301\314BB\315B\257\207" [cond eq (:insert) (vlf-tune-insert-bps) (:raw) (vlf-tune-insert-raw-bps) (:encode) (vlf-tune-encode-bps) (:write) (vlf-tune-write-bps) (:hexl) (vlf-tune-hexl-bps) (:dehexlify) (vlf-tune-dehexlify-bps)] 10 (#$ . 9708)])) #@160 Get measurement value according to TYPE, COEF and INDEX. If APPROXIMATE is t, do approximation for missing values. (fn TYPE COEF INDEX &optional APPROXIMATE) (defalias 'vlf-tune-assess #[1027 "\203%\306=\203\202>\307=\203 \202>\310=\203#\n\202>\311=\203- \202>\312=\2037\f\202>\313=\203  \203 \306=\203K\202z\307=\203U \202z\310=\203_\n\202z\311=\203i \202z\312=\203s\f\202z\313=\205z H\211:\203\206\211@\202\211\204\317\314\306=\203\226\202\312\307=\203\241 \202\312\310=\203\254\n\202\312\311=\203\267 \202\312\312=\203\302\f\202\312\313=\205\312 \"\202\211\315U\203\314\306=\203\341\202\307=\203\354 \202\310=\203\367\n\202\311=\203 \202\312=\203 \f\202\313=\205 \"\202\211\262\202x\202x\306=\203/\202^\307=\2039 \202^\310=\203C\n\202^\311=\203M \202^\312=\203W\f\202^\313=\203v \203v\306=\203k\202\232\307=\203u \202\232\310=\203\n\202\232\311=\203\211 \202\232\312=\203\223\f\202\232\313=\205\232 H\211:\203\246\211@\202q\211\204\351\306=\203\264\202\343\307=\203\276 \202\343\310=\203\310\n\202\343\311=\203\322 \202\343\312=\203\334\f\202\343\313=\205\343 \315I\202q\211\315U\203p\306=\203\371\202(\307=\203 \202(\310=\203 \n\202(\311=\203 \202(\312=\203!\f\202(\313=\205( \314\306=\2035\202i\307=\203@ \202i\310=\203K\n\202i\311=\203V \202i\312=\203a\f\202i\313=\205i \"I\202q\211\262\202x\206|\315_\207" [vlf-tune-insert-bps vlf-tune-insert-raw-bps vlf-tune-encode-bps vlf-tune-write-bps vlf-tune-hexl-bps vlf-tune-dehexlify-bps :insert :raw :encode :write :hexl :dehexlify vlf-tune-approximate-nearby 0 most-positive-fixnum] 11 (#$ . 10149)]) #@292 Calculate cumulative speed over TYPES for INDEX. If APPROXIMATE is t, do approximation for missing values. If TIME-MAX is non nil, return cumulative time instead of speed. If it is number, stop as soon as cumulative time gets equal or above. (fn TYPES INDEX &optional APPROXIMATE TIME-MAX) (defalias 'vlf-tune-score #[1026 "\3012l\302T_\247\211\203\\\211@\211:\203&\303@A@\n\n$\202.\303\304\n\n$\211\302U\203<\305\301\306\"\210\202T\245\\\262\203TX\203T\305\301\306\"\210\210A\266\202\202 \203d\202g\245\262\266\2030\207" [vlf-tune-step result 0 vlf-tune-assess 1.0 throw nil] 14 (#$ . 11941)]) #@154 Adjust `vlf-batch-size' to best nearby value over TYPES. INDEX if given, specifies search independent of current batch size. (fn TYPES &optional INDEX) (defalias 'vlf-tune-conservative #[513 "\304=\205\264 T\305\245\206\306\n! _W\203\304\202!\307\"\211\203\254\310U\203/\304\2024\307S\"\211\203\242\304=\204GT _W\203K\304\202Q\307T\"\211\204_\305\\ _\211\202\235\304=\203s\304=\206\235 _\211\202\235\247\203\206W\203\206\262S\262\247\203\225W\203\225T\262\211T _\211\262\262\202\247 _\211\262\202\262T _\211\266\203\207" [vlf-tune-enabled vlf-file-size vlf-batch-size vlf-tune-step t 2 vlf-tune-closest-index vlf-tune-score 0] 10 (#$ . 12582)]) #@157 Adjust `vlf-batch-size' to optimal value using binary search, optimizing over TYPES. MIN and MAX specify interval of indexes to search. (fn TYPES MIN MAX) (defalias 'vlf-tune-binary #[771 "\\Z\302W\203\303\304\245\"\202i\305\304_\\\306\"\307\"\211\203a\305\304_\\\306\"\307\"\211\204>T_\211\202\\W\203R\310T\304\245#\202\\\310\304\245#\266\202\202gT_\211\266\202\207" [vlf-tune-step vlf-batch-size 3 vlf-tune-conservative 2 round 4 vlf-tune-score vlf-tune-binary] 13 (#$ . 13301)]) #@124 Adjust `vlf-batch-size' to optimal known value using linear search. Optimize over TYPES up to MAX-IDX. (fn TYPES MAX-IDX) (defalias 'vlf-tune-linear #[514 "\302\211\211\211W\203&\303\304#\211\203W\203\262\211\262\210\211T\262\202T_\211\207" [vlf-tune-step vlf-batch-size 0 vlf-tune-score t] 9 (#$ . 13835)]) #@522 Adjust `vlf-batch-size' to optimal value optimizing on TYPES. TYPES is alist of elements that may be of form (type coef) or non list values in which case coeficient is assumed 1. Types can be :insert, :raw, :encode, :write, :hexl or :dehexlify. If LINEAR is non nil, use brute-force. In case requested measurement is missing, stop search and set `vlf-batch-size' to this value. FILE if given is filename to be used, otherwise `buffer-file-name'. Suitable for multiple batch operations. (fn TYPES &optional LINEAR FILE) (defalias 'vlf-tune-batch #[769 "\306=\205V \nT\307\245^ \245S\203\310\"\202T\f\311\206! !\203,\312!\210\202H\313X\203H\314W\203B\312\307\245\"\210\202H\315\316#\210\211\fU\205R\310\"\262\262\207" [vlf-tune-enabled vlf-tune-max vlf-file-size vlf-tune-step vlf-batch-size buffer-file-name t 2 vlf-tune-linear file-remote-p vlf-tune-conservative 1 3 vlf-tune-binary 0] 9 (#$ . 14170)]) #@257 Get best batch size according to existing measurements over TYPES. Best considered where primitive operations total is closest to `vlf-tune-load-time'. If MIN-IDX and MAX-IDX are given, confine search to this region. (fn TYPES &optional MIN-IDX MAX-IDX) (defalias 'vlf-tune-optimal-load #[769 "\306=\203\221\307\206\f\307]\262\211\206 \nT\310\245^ \245S^\262\211\f\306\211\307U\204rW\203r\311\306\f\\$\211\203g\fW\203P\312\262\211\fZ\202V\312\262\fZ\262\211W\203j\262\211\262\202j\312\262\210T\262\202% \307U\204=\203\203\202\216\203\214\202\216T_\207 \207" [vlf-tune-enabled vlf-tune-max vlf-file-size vlf-tune-step vlf-tune-load-time vlf-batch-size t 0 2 vlf-tune-score nil] 14 (#$ . 15109)]) #@149 Adjust `vlf-batch-size' slightly to better load time. Optimize on TYPES on the nearby REGION. Use 2 if REGION is nil. (fn TYPES &optional REGION) (defalias 'vlf-tune-load #[513 "\302=\205 \211\204 \303\262\304 !\305Z\306\307##\211\262\207" [vlf-tune-enabled vlf-batch-size t 2 vlf-tune-closest-index vlf-tune-optimal-load + 1] 10 (#$ . 15868)]) (provide 'vlf-tune)