Subject: Re: bug#18626: 24.3.94; communication with subprocess is slow

From: Stephen Leake <[email-masked]>
Date: Wed, 08 Oct 2014 08:29:59 -0500

Stephen Leake <[email-masked]> writes:

> It is still a problem on Windows; 12 seconds to read a megabyte is
> unacceptably slow for my real application.

The cause for this is the Sleep in _sys_read_ahead in w32.c. This is
called from reader_thread after the wait for a single char read
succeeds. The default wait is 50 ms, set by the elisp variable
w32-pipe-read-delay. Setting that to 0 gives:

(pipe-torture-read "/Projects/emacs/emacs-24.3.94/src/xdisp.c")
0.180000, 0.095000

only a factor of 2 slower than command-line cat.

w32-pipe-read-delay is a global variable. The comment in _sys_read_ahead
says there are problems with subprocess interaction when setting this to
0 on some systems. If that is still true, we may need to change this to
a per-subprocess setting.

In my real application, let-binding w32-pipe-read-delay for a short time
is possible, and a reasonable workaround.

--
-- Stephe