[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp performance on localhost
From: |
Michael Albinus |
Subject: |
Re: tramp performance on localhost |
Date: |
Sat, 22 Mar 2014 23:22:30 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Thierry Volpiatto <address@hidden> writes:
> Hi Michael,
Hi Thierry,
> Would be great to improve performance of some handlers on localhost,
> namely `file-directory-p' and friends, `directory-files' beeing slower but
> still reasonnably slower.
It is always a target of Tramp to improve performance. If you could
contribute code, you're really welcome!
> Here some tests:
>
> (defun test-tramp ()
> (cl-loop for f in (directory-files "/sudo:localhost:/usr/bin" t)
> collect (cond ((file-symlink-p f)
> (cons "a symlink" f))
> ((file-directory-p f)
> (cons "a directory" f))
> (t f))))
> (test-tramp)
> =>test-tramp 1 13.285881913 13.285881913
In my case (slower machine, larger directory):
=> test-tramp 1 66.758661848 66.758661848
Tramp caches file attributes. However, the cache expires. If you keep
the cache persistent, you get:
(setq tramp-completion-reread-directory-timeout nil
remote-file-name-inhibit-cache nil)
=> test-tramp 1 8.536997187 8.536997187
You see, it makes a big difference. Unfortunately, this cannot be the
default.
> (defun test-local ()
> (cl-loop for f in (directory-files "/usr/bin" t)
> collect (cond ((file-symlink-p f)
> (cons "a symlink" f))
> ((file-directory-p f)
> (cons "a directory" f))
> (t f))))
> (test-local)
> =>test-local 1 0.071230466 0.071230466
For comparison, I get
=> test-local 1 0.142116465 0.142116465
> As you can see the performances of first test are really bad compared
> with the same operation on non--remote file
> (/usr/bin vs /sudo:localhost:/usr/bin).
No doubt. But I don't know how to do it better, otherwise I would have
implemented it.
> Thanks.
Best regards, Michael.