From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: request for review: Doing direct file I/O in Emacs Lisp Date: Mon, 17 May 2004 07:04:14 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <87isf0vjtl.fsf@emptyhost.emptydomain.de> Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1084794992 28966 80.91.224.253 (17 May 2004 11:56:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 May 2004 11:56:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 17 13:56:27 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPgjL-0003u7-00 for ; Mon, 17 May 2004 13:56:27 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPgjK-0000Vx-00 for ; Mon, 17 May 2004 13:56:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPgaq-0004bE-P2 for emacs-devel@quimby.gnus.org; Mon, 17 May 2004 07:47:40 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BPg89-0001av-4e for emacs-devel@gnu.org; Mon, 17 May 2004 07:18:02 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BPg6W-0001Qo-7u for emacs-devel@gnu.org; Mon, 17 May 2004 07:16:52 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPfup-0008If-1J for emacs-devel@gnu.org; Mon, 17 May 2004 07:04:15 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1BPfuo-0005oM-En; Mon, 17 May 2004 07:04:14 -0400 Original-To: John Wiegley In-reply-to: (message from John Wiegley on Sat, 15 May 2004 14:36:38 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23577 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23577 Hmm.. that IS curious. In the save-buffer case, I call insert-and-inherit in a temp buffer thousands of times, then one call to save-buffer. In the write-region case, I am calling write-region thousands of times. I think the difference is the constant filesystem access in the latter case. Now that I see what the last alternative consists of, I am sure that is true. You could try calling write-region using a temporary buffer after making sure that buffer-file-coding-system is set. That might be somewhat faster than using save-buffer. > I can't understand what alternatives you have compared. > Could you please explain them more concretely? If I start a process with start-process (/usr/bin/cat) and redirect its output to a file, it is far slower than if I simply output the same data to a file (eshell/cat) -- even though the resulting "output" in both cases is the same. Why is receiving output via a process sentinel so slow? As far as I can see, neither of the two cases you described involves receiving output from a subprocesses at all, so neither one involves the sentinel. I suspect that the former case is slow because sending input to the subprocess takes time. Someone else suggested process switching overhead.may be a big factor in that. It sounds plausible.