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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 04 Oct 2014 11:07:14 +0300

> From: [email-masked]
> Date: Sat, 04 Oct 2014 01:47:16 -0500
> 
> (find-file "emacs-24.3.94/src/xdisp.c")
> (pipe-torture "cat.exe")
>     => 11.255173
> 
> The time varies slightly with each run. "cat.exe" here is from Cygwin.
> 
> For comparison, in a Cygwin bash shell on the same system:
> 
> $ cd /tmp
> $ time cat < /Projects/emacs/emacs-24.3.94/src/xdisp.c > xdisp.c
> real	0m0.051s
> user	0m0.000s
> sys	0m0.030s

Can you present similar timings from some Posix platform for
comparison?

> Doing (setq process-adaptive-read-buffering nil) did not change the
> timing.

AFAIK, this variable only matters for reading the subprocess output.
Since you didn't present the results for that, there's no evidence yet
which would support this conclusion.

> (pipe-torture "debug.exe" "4096")
> 4.797574
> 
> (pipe-torture "debug.exe" "40000")
> 0.523758
> 
> The test with "debug.exe" can also be run in Emacs 24.3.1, since it does
> not mix reads and writes (see bug 18420); it gives a time comparable to
> the command-line "cat": 0.053000

That's actually evidence that playing with the 2 parameters mentioned
on emacs-devel might make the time lower.

Still, the question is what happens on GNU/Linux or some other popular
Posix platform, in comparison with Windows.  I get ~1.2 sec on one
such machine, which is still a significant slowdown wrt file I/O
outside of Emacs, by a factor of about 50.

> In emacs 24.3.94:
> (pipe-torture-read "/Projects/emacs/emacs-24.3.94/src/xdisp.c")
> "read time 11.965184"
> 
> In Windows native emacs 24.3.1:
> (pipe-torture-read "/Projects/emacs/emacs-24.3.94/src/xdisp.c")
> "read time 11.992000"

That's identical, and expected: the changeset that solved the deadlock
case only changes the way Emacs treats the write end of the pipe.  The
read end behaves in Emacs 24.4 identically to what it did in 24.3.