From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18626: 24.3.94; communication with subprocess is slow Date: Sat, 04 Oct 2014 11:32:00 +0300 Message-ID: <83lhowgrr3.fsf@gnu.org> References: <85wq8ge3gr.fsf@stephe-leake.org> <85d2a8dzkh.fsf@stephe-leake.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1412411610 20554 80.91.229.3 (4 Oct 2014 08:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Oct 2014 08:33:30 +0000 (UTC) Cc: 18626@debbugs.gnu.org To: Stephen Leake Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 04 10:33:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XaKmH-0008FW-K5 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Oct 2014 10:33:21 +0200 Original-Received: from localhost ([::1]:42982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaKmH-0007jL-11 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Oct 2014 04:33:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaKm5-0007jC-2z for bug-gnu-emacs@gnu.org; Sat, 04 Oct 2014 04:33:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XaKly-0001mb-Re for bug-gnu-emacs@gnu.org; Sat, 04 Oct 2014 04:33:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaKly-0001mX-Nx for bug-gnu-emacs@gnu.org; Sat, 04 Oct 2014 04:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XaKly-00059u-5r for bug-gnu-emacs@gnu.org; Sat, 04 Oct 2014 04:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Oct 2014 08:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18626 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18626-submit@debbugs.gnu.org id=B18626.141241152319755 (code B ref 18626); Sat, 04 Oct 2014 08:33:02 +0000 Original-Received: (at 18626) by debbugs.gnu.org; 4 Oct 2014 08:32:03 +0000 Original-Received: from localhost ([127.0.0.1]:60737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XaKl1-00058Z-5C for submit@debbugs.gnu.org; Sat, 04 Oct 2014 04:32:03 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:51044) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XaKkx-000588-To for 18626@debbugs.gnu.org; Sat, 04 Oct 2014 04:32:01 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NCW00900VDTY200@mtaout27.012.net.il> for 18626@debbugs.gnu.org; Sat, 04 Oct 2014 11:26:37 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NCW00OFSVGCX680@mtaout27.012.net.il>; Sat, 04 Oct 2014 11:26:37 +0300 (IDT) In-reply-to: <85d2a8dzkh.fsf@stephe-leake.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94116 Archived-At: > From: Stephen Leake > Date: Sat, 04 Oct 2014 03:11:26 -0500 > > The send_process time delay is the cause of the slowdown in write: > > (find-file "xdisp.c") > (pipe-torture "debug.exe" "4096") > > delay time > ------------------------ > 20 * 1000 * 1000 4.450068 > 10 * 1000 * 1000 2.443788 > 0 * 1000 * 1000 hangs until C-g > > xdisp.c has 974233 bytes; with a subprocess read buffer of 4096 and a > delay of 0.020 seconds, that gives a send time of (* 0.020 (/ 974233 > 4096)) = 4.74, which is close to what we see above. > > One way around the write delay is to use a large enough read buffer in > the subprocess. In my current real application, this is easy and also > gives other benefits. > > I'm not clear why Emacs hangs with a delay of 0. The subprocess should > be running on a separate CPU core, so even if the Emacs process is in a > busy wait loop, the subprocess should read input. Did you try with 5 msec instead of zero? Anyway, for 24.4 all I can suggest is a variable to replace the fixed 20 msec value. Doing anything more complicated than that would be too dangerous this late into the pretest.