Thierry Volpiatto <[email protected]> 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.

_______________________________________________
Tramp-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to