emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 22.1.50; insert-file-contents is slow under tramp


From: Stefan Monnier
Subject: Re: 22.1.50; insert-file-contents is slow under tramp
Date: Mon, 27 Aug 2007 00:16:40 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

>>> Yes. I've installed a patch in the trunk, which makes a fast track for
>>> "remote" files being on localhost.
>> 
>> How does that work?  I mean when accessing files on the localhost with
>> Tramp, the most likely situation I can think of is the `su' method so how
>> what does your "fast track" do to transfer the file faster?  Does it copy it
>> to /tmp at the "remote" end, then make it world-readable, then copy it on
>> the "local" end, then remove it at the remote end?

> Similar approach. It calls `tramp-do-copy-or-rename-file-directly',
> which copies the "remote" file to /tmp, and assigns proper
> permissions.

What would be proper permissions?  I mean: how do you make sure that some
nasty third party won't be able to read the content of that temp file, while
still making it possible for Emacs to access the file?

> I haven't investigated too much. mimencode and base64-decode are pretty
> fast, even on my stone-age machine, with an 8MB sized file:

> | (with-current-buffer (get-buffer-create "foo")
> |   (elp-instrument-function 'call-process)
> |   (elp-instrument-function 'base64-decode-region)
> |   (erase-buffer)
> |
> |   (call-process "mimencode" nil t nil "/var/cache/apt/pkgcache.bin")
> |   (base64-decode-region (point-min) (point-max))
> |   (elp-results))
> |
> | Function Name         Call Count  Elapsed Time  Average Time
> | ====================  ==========  ============  ============
> | base64-decode-region  1           7.732203      7.732203
> | call-process          1           1.917887      1.917887

> But with the installed "fast track", it is remarkable faster than even
> these two basic functions:

1MB/s for base64 sounds terribly slow.  My 266MHz home-router can send
and encrypt data from disk to the network at about that speed.
But admittedly, we're not talking `mimencode' but base64-decode-region which
may include a lot of overhead to extract and insert data from/to the buffer.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]