]> git.eshelyaron.com Git - emacs.git/commitdiff
Speed up reading sub-process output on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Sat, 30 Jun 2018 08:43:42 +0000 (11:43 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 30 Jun 2018 08:43:42 +0000 (11:43 +0300)
* src/w32proc.c (syms_of_ntproc) <w32-pipe-read-delay>: Set to
zero.  For the details, see this discussion:
http://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00711.html.
* src/w32.c (_sys_read_ahead): Update the commentary for
w32-pipe-read-delay usage.

* doc/emacs/msdos.texi (Windows Processes): Document
w32-pipe-read-delay.

* etc/NEWS: Mention the change of the value of w32-pipe-read-delay.

doc/emacs/msdos.texi
etc/NEWS
src/w32.c
src/w32proc.c

index 679bdd3e83bf6fc25e6b6696d88dd55a5de13029..c69c7d37f9beda754b8acc18abd0f3d978a18bc9 100644 (file)
@@ -808,6 +808,13 @@ communications with subprocesses to programs that exhibit unusual
 behavior with respect to buffering pipe I/O.
 
 @ifnottex
+@vindex w32-pipe-read-delay
+  If you need to invoke MS-DOS programs as Emacs subprocesses, you may
+see low rate of reading data from such programs.  Setting the variable
+@code{w32-pipe-read-delay} to a non-zero value may improve throughput
+in these cases; we suggest the value of 50 for such situations.  The
+default is zero.
+
 @findex w32-shell-execute
   The function @code{w32-shell-execute} can be useful for writing
 customized commands that run MS-Windows applications registered to
index eb9169a776240b8df72d1b486393f04b5e2768b3..f5332c07828dff97f371446479e5e2f04ec60908 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -851,6 +851,17 @@ retrieving values stored under a given key.  It is intended to be used
 for supporting features such as XDG-like location of important files
 and directories.
 
++++
+** The default value of 'w32-pipe-read-delay' is now zero.
+This speeds up reading output from sub-processes that produce a lot of
+data.
+
+This variable may need to be non-zero only when running DOS programs
+as Emacs subprocesses, which by now is not supported on modern
+versions of MS-Windows.  Set this variable to 50 if for some reason
+you need the old behavior (and please report such situations to Emacs
+developers).
+
 \f
 ----------------------------------------------------------------------
 This file is part of GNU Emacs.
index e93aaab9ca1de5d05c8252769a8c2bbe40dd28b4..c848b33b2af2c5ec2dfda7af862fb6d1438e1627 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -8469,13 +8469,14 @@ _sys_read_ahead (int fd)
     {
       rc = _read (fd, &cp->chr, sizeof (char));
 
-      /* Give subprocess time to buffer some more output for us before
-        reporting that input is available; we need this because Windows 95
-        connects DOS programs to pipes by making the pipe appear to be
-        the normal console stdout - as a result most DOS programs will
-        write to stdout without buffering, ie. one character at a
-        time.  Even some W32 programs do this - "dir" in a command
-        shell on NT is very slow if we don't do this. */
+      /* Optionally give subprocess time to buffer some more output
+        for us before reporting that input is available; we may need
+        this because Windows 9X connects DOS programs to pipes by
+        making the pipe appear to be the normal console stdout -- as
+        a result most DOS programs will write to stdout without
+        buffering, i.e., one character at a time.  Even some W32
+        programs do this -- "dir" in a command shell on NT is very
+        slow if we don't do this.  */
       if (rc > 0)
        {
          int wait = w32_pipe_read_delay;
index 28d7b6611f6017681b5091f88d1d32c05f482442..5934669c3633263f614368a2fd961e18f1555956 100644 (file)
@@ -3763,14 +3763,17 @@ them blocking when trying to access unmounted drives etc.  */);
 
   DEFVAR_INT ("w32-pipe-read-delay", w32_pipe_read_delay,
              doc: /* Forced delay before reading subprocess output.
-This is done to improve the buffering of subprocess output, by
-avoiding the inefficiency of frequently reading small amounts of data.
+This may need to be done to improve the buffering of subprocess output,
+by avoiding the inefficiency of frequently reading small amounts of data.
+Typically needed only with DOS programs on Windows 9X; set to 50 if
+throughput with such programs is slow.
 
 If positive, the value is the number of milliseconds to sleep before
-reading the subprocess output.  If negative, the magnitude is the number
-of time slices to wait (effectively boosting the priority of the child
-process temporarily).  A value of zero disables waiting entirely.  */);
-  w32_pipe_read_delay = 50;
+signaling that output from a subprocess is ready to be read.
+If negative, the value is the number of time slices to wait (effectively
+boosting the priority of the child process temporarily).
+A value of zero disables waiting entirely.  */);
+  w32_pipe_read_delay = 0;
 
   DEFVAR_INT ("w32-pipe-buffer-size", w32_pipe_buffer_size,
              doc: /* Size of buffer for pipes created to communicate with subprocesses.