[Top][All Lists]

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

Re: request for review: Doing direct file I/O in Emacs Lisp

From: John Wiegley
Subject: Re: request for review: Doing direct file I/O in Emacs Lisp
Date: Fri, 14 May 2004 14:43:59 -0700
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (darwin)

Richard Stallman <address@hidden> writes:

> When eshell sees a redirect from a builtin, I think it would be most
> efficient to produce the output in a buffer and write it with
> write-region into the file.

Below are the results of comparing write-region to the file-handle
API.  This test used Eshell's builtin cat to write 21MB to another

  ~74s  save-buffer (the current method)
  ~82s  file-handle-write
 ~250s  write-region [with call to `message' disabled]
 ~318s  write-region

It is interesting that write-region is by far the most inefficient,
and that my file-handle API is not the fastest method.  I therefore
retract my earlier proposal.

However, the real slowdown is with start-process, as others mentioned.
Here are the times for doing the same cat, but using the system's cat:

 ~952s  file-handle-write
  ...s  save-buffer (the current method)

In this case, save-buffer took so long that after 20 minutes Emacs
hung (for some other reason), and I didn't have sufficient patience to
run the test again.

> When it is a matter of a subprocess, what could be useful is a
> feature for start-process to specify files for additional
> descriptors.  That would be a completely different feature.

This would be very useful.


reply via email to

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