aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-06-30 11:43:42 +0300
committerEli Zaretskii2018-06-30 11:43:42 +0300
commited65ea18152636500399a7b6b75c87bac7d4ef2b (patch)
treefc7fe235cc9866326b5bab8c13255c2ef9ffbf2c
parent3b4e65e797e15668345cf606c7d822cce11f17b2 (diff)
downloademacs-ed65ea18152636500399a7b6b75c87bac7d4ef2b.tar.gz
emacs-ed65ea18152636500399a7b6b75c87bac7d4ef2b.zip
Speed up reading sub-process output on MS-Windows
* 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.
-rw-r--r--doc/emacs/msdos.texi7
-rw-r--r--etc/NEWS11
-rw-r--r--src/w32.c15
-rw-r--r--src/w32proc.c15
4 files changed, 35 insertions, 13 deletions
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index 679bdd3e83b..c69c7d37f9b 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -808,6 +808,13 @@ communications with subprocesses to programs that exhibit unusual
808behavior with respect to buffering pipe I/O. 808behavior with respect to buffering pipe I/O.
809 809
810@ifnottex 810@ifnottex
811@vindex w32-pipe-read-delay
812 If you need to invoke MS-DOS programs as Emacs subprocesses, you may
813see low rate of reading data from such programs. Setting the variable
814@code{w32-pipe-read-delay} to a non-zero value may improve throughput
815in these cases; we suggest the value of 50 for such situations. The
816default is zero.
817
811@findex w32-shell-execute 818@findex w32-shell-execute
812 The function @code{w32-shell-execute} can be useful for writing 819 The function @code{w32-shell-execute} can be useful for writing
813customized commands that run MS-Windows applications registered to 820customized commands that run MS-Windows applications registered to
diff --git a/etc/NEWS b/etc/NEWS
index eb9169a7762..f5332c07828 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -851,6 +851,17 @@ retrieving values stored under a given key. It is intended to be used
851for supporting features such as XDG-like location of important files 851for supporting features such as XDG-like location of important files
852and directories. 852and directories.
853 853
854+++
855** The default value of 'w32-pipe-read-delay' is now zero.
856This speeds up reading output from sub-processes that produce a lot of
857data.
858
859This variable may need to be non-zero only when running DOS programs
860as Emacs subprocesses, which by now is not supported on modern
861versions of MS-Windows. Set this variable to 50 if for some reason
862you need the old behavior (and please report such situations to Emacs
863developers).
864
854 865
855---------------------------------------------------------------------- 866----------------------------------------------------------------------
856This file is part of GNU Emacs. 867This file is part of GNU Emacs.
diff --git a/src/w32.c b/src/w32.c
index e93aaab9ca1..c848b33b2af 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -8469,13 +8469,14 @@ _sys_read_ahead (int fd)
8469 { 8469 {
8470 rc = _read (fd, &cp->chr, sizeof (char)); 8470 rc = _read (fd, &cp->chr, sizeof (char));
8471 8471
8472 /* Give subprocess time to buffer some more output for us before 8472 /* Optionally give subprocess time to buffer some more output
8473 reporting that input is available; we need this because Windows 95 8473 for us before reporting that input is available; we may need
8474 connects DOS programs to pipes by making the pipe appear to be 8474 this because Windows 9X connects DOS programs to pipes by
8475 the normal console stdout - as a result most DOS programs will 8475 making the pipe appear to be the normal console stdout -- as
8476 write to stdout without buffering, ie. one character at a 8476 a result most DOS programs will write to stdout without
8477 time. Even some W32 programs do this - "dir" in a command 8477 buffering, i.e., one character at a time. Even some W32
8478 shell on NT is very slow if we don't do this. */ 8478 programs do this -- "dir" in a command shell on NT is very
8479 slow if we don't do this. */
8479 if (rc > 0) 8480 if (rc > 0)
8480 { 8481 {
8481 int wait = w32_pipe_read_delay; 8482 int wait = w32_pipe_read_delay;
diff --git a/src/w32proc.c b/src/w32proc.c
index 28d7b6611f6..5934669c363 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3763,14 +3763,17 @@ them blocking when trying to access unmounted drives etc. */);
3763 3763
3764 DEFVAR_INT ("w32-pipe-read-delay", w32_pipe_read_delay, 3764 DEFVAR_INT ("w32-pipe-read-delay", w32_pipe_read_delay,
3765 doc: /* Forced delay before reading subprocess output. 3765 doc: /* Forced delay before reading subprocess output.
3766This is done to improve the buffering of subprocess output, by 3766This may need to be done to improve the buffering of subprocess output,
3767avoiding the inefficiency of frequently reading small amounts of data. 3767by avoiding the inefficiency of frequently reading small amounts of data.
3768Typically needed only with DOS programs on Windows 9X; set to 50 if
3769throughput with such programs is slow.
3768 3770
3769If positive, the value is the number of milliseconds to sleep before 3771If positive, the value is the number of milliseconds to sleep before
3770reading the subprocess output. If negative, the magnitude is the number 3772signaling that output from a subprocess is ready to be read.
3771of time slices to wait (effectively boosting the priority of the child 3773If negative, the value is the number of time slices to wait (effectively
3772process temporarily). A value of zero disables waiting entirely. */); 3774boosting the priority of the child process temporarily).
3773 w32_pipe_read_delay = 50; 3775A value of zero disables waiting entirely. */);
3776 w32_pipe_read_delay = 0;
3774 3777
3775 DEFVAR_INT ("w32-pipe-buffer-size", w32_pipe_buffer_size, 3778 DEFVAR_INT ("w32-pipe-buffer-size", w32_pipe_buffer_size,
3776 doc: /* Size of buffer for pipes created to communicate with subprocesses. 3779 doc: /* Size of buffer for pipes created to communicate with subprocesses.