all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>, emacs-devel@gnu.org
Subject: Re: Remote display-time-mail-file
Date: Thu, 30 Sep 2010 15:07:34 +0200	[thread overview]
Message-ID: <878w2jv0q1.fsf@gmx.de> (raw)
In-Reply-To: 83r5grzaei.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
>> Cc: Michael Albinus <michael.albinus@gmx.de>, emacs-devel@gnu.org
>> Date: Sat, 18 Sep 2010 11:00:27 +0200
>>
>> > Maybe I'm missing something, but I don't see how this can help.  For
>> > starters, time.el needs Tramp to check the remote every time, so the
>> > cache just gets in the way.
>>
>> But each use from time.el might end up calling some internal Tramp
>> functions several times, so the cache may still speed things up.
>
> That's true, but my conclusion from this is different: we probably
> should have finer granularity of the cache setting.
>
> I guess some of the internal Tramp functions need not be called any
> time soon after the first call, for example those that find out which
> method to use to access the remote and which scripts to run on the
> remote side.  Other internal functions will need to run every time
> display-time-file-nonempty-p is called.  And there could be those in
> between.  So perhaps these internal functions should be categorized in
> some reasonable manner, and then corresponding values added to the
> repertoire of tramp-cache-inhibit-cache's values, so that Lisp
> programs could have finer control on what is being cached and when the
> cache is refreshed.

I did some tests. It is hard to predict, which primitive functions are
called where, and in majority thes are file-attributes, file-exists-p,
file-readable-p, file-writable-p. Other primitive functions do profit
from those cached values, or they aren't called as much that it is worth
to spend extra handling for caching.

Therefore, I propose the following patch:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/files.el.~101670~	2010-09-30 15:02:06.590646221 +0200
--- /home/albinus/src/emacs/lisp/files.el	2010-09-30 14:24:08.655019756 +0200
***************
*** 934,939 ****
--- 934,968 ----
  	(funcall handler 'file-remote-p file identification connected)
        nil)))

+ (defcustom remote-file-name-inhibit-cache 10
+   "Inhibit remote file name cache read access, when `t'.
+ `nil' means to accept cache entries unconditionally.  An integer
+ prevents using of cache entries if they are older than this
+ amount of seconds.
+
+ File attributes of remote files are cached for better performance.
+ If they are changed out of Emacs' control, the cached values
+ become invalid, and must be invalidated.
+
+ In case a remote file is checked regularly, it might be
+ reasonable to let-bind this variable to a value less then the
+ time period between two checks.
+
+ Example:
+
+   \(defun display-time-file-nonempty-p \(file)
+     \(let \(\(remote-file-name-inhibit-cache \(- display-time-interval 5)))
+       \(and \(file-exists-p file)
+            \(< 0 \(nth 7 \(file-attributes \(file-chase-links file)))))))"
+   :group 'files
+   :version "24.1"
+   :type `(choice
+ 	  (const   :tag "Do not inhibit file name cache" nil)
+ 	  (const   :tag "Do not use file name cache" t)
+ 	  (integer :tag "Do not use file name cache"
+ 		   :format "Do not use file name cache older then %v seconds"
+ 		   :value 10)))
+
  (defun file-local-copy (file)
    "Copy the file FILE into a temporary file on this machine.
  Returns the name of the local copy, or nil, if FILE is directly
--8<---------------cut here---------------end--------------->8---

Tramp would be adapted accordingly, of course.

Best regards, Michael.



  parent reply	other threads:[~2010-09-30 13:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 18:38 Remote display-time-mail-file Eli Zaretskii
2010-09-16 20:14 ` Eli Zaretskii
2010-09-16 21:01   ` Michael Albinus
2010-09-17 11:48     ` Eli Zaretskii
2010-09-17 13:11       ` Michael Albinus
2010-09-17 15:37         ` Stefan Monnier
2010-09-17 20:26           ` Michael Albinus
2010-09-17 20:59             ` Michael Albinus
2010-09-17 21:43               ` Eli Zaretskii
2010-09-18  6:47                 ` Michael Albinus
2010-09-18  9:00                 ` Stefan Monnier
2010-09-18  9:06                   ` Michael Albinus
2010-09-18  9:08                   ` Eli Zaretskii
2010-09-18 10:49                     ` Michael Albinus
2010-09-30 13:07                     ` Michael Albinus [this message]
2010-09-30 13:29                       ` Eli Zaretskii
2010-09-30 14:01                         ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w2jv0q1.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.