From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David.Kastrup@t-online.de (David Kastrup) Newsgroups: gmane.emacs.devel Subject: Re: Any idea about what makes Emacs slow reading on pipes? Date: 18 May 2003 12:12:54 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <5x1xyye3y4.fsf@kfs2.cua.dk> <5xznllw0wp.fsf@kfs2.cua.dk> <84smrcskwu.fsf@lucy.is.informatik.uni-duisburg.de> Reply-To: dak@gnu.org NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1053252746 20684 80.91.224.249 (18 May 2003 10:12:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 18 May 2003 10:12:26 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun May 18 12:12:25 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19HL9V-0005NU-00 for ; Sun, 18 May 2003 12:12:25 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19HLIl-0006Ug-00 for ; Sun, 18 May 2003 12:21:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19HLAw-0007Qi-07 for emacs-devel@quimby.gnus.org; Sun, 18 May 2003 06:13:54 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19HLAP-0006oQ-00 for emacs-devel@gnu.org; Sun, 18 May 2003 06:13:21 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19HLAK-0006bE-00 for emacs-devel@gnu.org; Sun, 18 May 2003 06:13:18 -0400 Original-Received: from mailout02.sul.t-online.com ([194.25.134.17]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19HLA2-0005t8-00 for emacs-devel@gnu.org; Sun, 18 May 2003 06:12:58 -0400 Original-Received: from fwd00.sul.t-online.de by mailout02.sul.t-online.com with smtp id 19HLA2-0002ec-09; Sun, 18 May 2003 12:12:58 +0200 Original-Received: from localhost.localdomain (520018396234-0001@[62.226.12.133]) by fwd00.sul.t-online.com with esmtp id 19HL9z-1KI1QWC; Sun, 18 May 2003 12:12:55 +0200 Original-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h4IACsZF012456 for ; Sun, 18 May 2003 12:12:54 +0200 Original-Received: (from dak@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id h4IACssE012452; Sun, 18 May 2003 12:12:54 +0200 Original-To: emacs-devel@gnu.org In-Reply-To: <84smrcskwu.fsf@lucy.is.informatik.uni-duisburg.de> Original-Lines: 55 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Sender: 520018396234-0001@t-dialin.net X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13968 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13968 kai.grossjohann@gmx.net (Kai Gro=DFjohann) writes: > David.Kastrup@t-online.de (David Kastrup) writes: >=20 > > So what can we do about this? > > > > a) use only SMP systems > > b) pester Linux developers to be less eager with context switches on > > select. I am trying this course now, but it will of course take > > time to register and other OS might have similar problems > > c) make a super-efficient path for process output arriving in tiny > > chunks, since this is what we will be force-fed most of the time. >=20 > I wonder if the invocation of the process filter function could be > optimized. >=20 > Idea: the current situation might be this: when Emacs gets stuff from > a process, it reads the data, stashes it somewhere in a buffer, then > invokes the process filter function on the stashed-away stuff. >=20 > We might change it so that, after stashing the stuff in a buffer, > Emacs looks again if more data is available from the same process. The data will not become available unless the process gets the CPU time to produce it, and we can't persuade the operating system to give the process the CPU time unless we yield the CPU. The solution, as explained elsewhere, is to throttle the calls to the process filter function and actively delay processing if we find ourselves processing small packets at a high rate. > That way, Emacs might continue reading stuff from the process until > the process has nothing to produce. Well, people always complain about Emacs being an operating system, not an editor, but scheduling processes is not yet its responsibility. I just propose that we help out the operating system in its scheduling a bit... since the bad consequences occur on our side of the equation, we should do what we can reasonable do to avoid them even where, strictly speaking, the OS is to blame for assuming that Emacs will be happier with many small packets instead of a few large ones. But the "slow start xterm" effect, where the performance of an xterm with od -v /dev/zero|dd obs=3D1 gets much faster if you start while true;do :;done in a separate term is very common on single-processor machines. I always found it curious and never thought about it further. --=20 David Kastrup, Kriemhildstr. 15, 44793 Bochum