On Tuesday, December 11, 2012, Taylor R Campbell wrote:

> Whoops, looks like I neglected to answer this last month.
>
>    Date: Thu, 1 Nov 2012 10:05:13 -0400
>    From: Richard Loveland <loveland.rich...@gmail.com>
>
>    My layman's interpretation is:
>
>    1. write the file (quick)
>    2. do something called `thread_selfid' (slow)
>    3. stat the `Invoice Service.txt' file (quick, it exists)
>    4. stat the `.git' directory, which does not exist (slow)
>
>    The dtruss output is littered with these stat calls to non-existent
>    version control directories -- I'm guessing they just correspond to
>    `file-exists?' type procedures?
>
> Sounds about right: vc is trying to detect whether you're using any
> revision control system by statting the revision control files and
> directories.  Unfortunately, at the moment, there's no good way to
> turn this off...  Perhaps we ought to have a variable controlling
> whether vc autodetection happens, which VC-HOOK:FIND-FILE would check,
> or something like that.
>

I've created a patch (attached) that solves this issue for me. Rather than
turn off VC-HOOK:FIND-FILE, I've enabled a quicker check in
VC-HOOK:AFTER-SAVE of whether a buffer has the 'VC-MASTER property when the
file is saved. The previous version of VC-HOOK:AFTER-SAVE was calling the
same procedure (BUFFER-VC-MASTER) as VC-HOOK:FIND-FILE. Unfortunately,
BUFFER-VC-MASTER calls several nested procedures, each of which perform
loops. I suspect that this heavy checking is worthwhile when opening a
file, since the buffer's 'VC-MASTER property doesn't exist yet, but seems
unnecessary in the VC-HOOK:AFTER-SAVE case (since VC-HOOK:FIND-FILE should
already have run and set 'VC-MASTER).

This results in a speedup of factor 5 or so when saving files mounted via
WebDAV (~30 seconds down to ~6). Now Edwin's performance is directly on par
with GNU Emacs when saving these files on my system.

Please let me know if this patch is acceptable. If so I'm happy to sign
papers, etc. as needed.
diff --git a/src/edwin/vc.scm b/src/edwin/vc.scm
index c468bb6..e0298a5 100644
--- a/src/edwin/vc.scm
+++ b/src/edwin/vc.scm
@@ -307,7 +307,7 @@ Otherwise, VC will compare the file to the copy in the repository."
 		     (lambda (buffer) (vc-hook:after-buffer-save buffer)))
 
 (define (vc-hook:after-buffer-save buffer)
-  (let ((master (buffer-vc-master buffer #f)))
+  (let ((master (buffer-get buffer 'VC-MASTER #f)))
     (if master
 	(vc-mode-line master buffer))))
 
_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to