[svk-devel] "svk info" latency vs. vc-svk.el: pain vs. gain
Sam Vilain
sam at vilain.net
Sun Aug 6 00:52:23 EDT 2006
Chip Salzenberg wrote:
> I'm using svk (thanks clkao!) and vc-svk.el (thanks Sam!) and I mostly enjoy
> the combination. Except: vc-svk.el uses 'svk info' to determine whether a
> file is source-controlled, and that's a four-second latency for every file.
>
The version I wrote just did read .svk/config using e-lisp;
(defun vc-svk-registered (file)
"Return true if FILE is registered under SVK."
;; First, a quick false positive test: is there a `.svk/entries' file?
(vc-svk-read-config)
(let ((dirname (or (replace-regexp-in-string "/\$" ""
(file-name-directory
(file-truename file))) ""))
;; make sure that the file name is searched case-sensitively
(case-fold-search nil))
(let ((found nil))
(while (and (not found)
(> (length dirname) 0))
(if (member dirname vc-svk-checkout-paths)
(setq found t)
)
(setf dirname (replace-regexp-in-string "/[^/]*$" "" dirname))
)
(and found (vc-svk-run-status file))))
)
; This method assumes ~/.svk/config was saved with $YAML::indent = 2
; and that keys are only ever quoted with single quotes
; note - ph34r my ub3r lisp p0w3rs - mugwump.
;(defstruct checkoutpath path true)
(defun vc-svk-read-config ()
"reads the SVK config file in and sets relevant variables"
(with-temp-buffer
(vc-insert-file "~/.svk/config")
(goto-char (point-min))
(re-search-forward "^checkout:")
(let ((start (re-search-forward "^ hash:.*$"))
(end (re-search-forward "^ [^ ]+:.*$")))
(setf vc-svk-checkout-paths ())
(goto-char start)
(while (< (point) end)
(if (or (looking-at "^ \\(.*\\):$")
(looking-at "^ '\\(.*\\)':$")
)
(setf vc-svk-checkout-paths (cons (match-string 1)
vc-svk-checkout-paths))
)
(goto-char (+ (point) 1))
(if (re-search-forward "^ [^ ]" nil t)
(goto-char (- (point) 5))
(setf end (point)))
)
vc-svk-checkout-paths
)
))
> When I 'emacs *.c', I have to wait a long time.
>
> It's getting annoying. So until I get Parrot working, I guess I'm stuck
> with it being slow. Ironically enough, this slowdown is a slight drag on
> Parrot development. :-(
>
> I've strace'd 'svk info' and it spends most of those four seconds just
> looking for and parsing Perl modules, so there's no easy fix. Perhaps
> SVK could make more extensive use of deferred loading, e.g. C<use autouse>?
>
> An Emacs-specific wrapper around 'svk info' that caches answers could help.
> It's a terrible hack, though.
>
> Or, perhaps, a minimal 'tinysvk info' program could avoid all the extensive
> module loads but knows enough to just say whether a file is controlled or
> not. For example, it could load only YAML, look in ~/.svk/config for the
> current svn repo, and then (speculation begins) use 'svn' directly in some
> way to find out whether the given file is currently controlled.
>
> Thoughts? Solutions?
More information about the svk-devel
mailing list