From: storm@cua.dk (Kim F. Storm)
Cc: offby1@blarg.net, Eli Zaretskii <eliz@elta.co.il>,
David Kastrup <dak@gnu.org>,
emacs-devel@gnu.org
Subject: Re: Fix for slow process output processing (please test).
Date: 06 Jan 2004 00:28:57 +0100 [thread overview]
Message-ID: <m3ptdy7z5y.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <uhdzadvh7.fsf@jasonrumney.net>
Jason Rumney <jasonr@gnu.org> writes:
> "Eli Zaretskii" <eliz@elta.co.il> writes:
>
> > > From: David Kastrup <dak@gnu.org>
> > > Date: 05 Jan 2004 16:57:14 +0100
> > > >
> > > > I suppose that process-adaptive-read-buffering isn't really needed
> > > > on Windows,
> > >
> > > Since Windows is slow, anyway?
> >
> > I think the reason is that Windows never feeds Emacs with such small
> > chunks from a pipe.
>
> Maybe, but my understanding was that big chunks would still be
> reasonably fast using the new code, so we should try to find
> out. Perhaps there is a bug in our version of select that does not
> handle this situation properly, or perhaps the new buffering code needs
> further improvements.
With the code below (provided by David some time ago), I see a big
difference on the Linux 2.4 kernel I'm using (Redhat 9.0).
Maybe someone can try it (just do M-x make-test) with and without
adaptive buffering enabled on windows.
(defvar test-pattern nil)
(defvar test-start nil)
(defun test-filter (process string printer)
(push (cons (floor (- (float-time) test-start))
(length string)) test-pattern)
(princ string printer))
(defun test-predicate (a b)
(if (equal (car a) (car b))
(< (cdr a) (cdr b))
(< (car a) (car b))))
(defun test-sentinel (process string printer finish)
(princ string printer)
(delete-process process)
(setq test-pattern (sort test-pattern #'test-predicate))
(let (elt lastelt lastcount)
(while
(prog1
(setq elt (pop test-pattern))
(if (equal lastelt elt)
(when lastelt (setq lastcount (1+ lastcount)))
(when lastelt
(princ (format "%4d blocks with size %4d\n"
lastcount (cdr lastelt)) printer))
(setq lastcount 1)))
(when (not (eq (car lastelt) (car elt)))
(princ (format "Time:%3d\n" (car elt)) printer))
(setq lastelt elt)))
(if finish (funcall finish)))
(defun make-test (printer &optional finish)
(interactive (let ((buffer (get-buffer-create "*test*")))
(switch-to-buffer buffer)
(erase-buffer)
(list buffer)))
(setq test-pattern nil test-start (float-time))
(let ((process (start-process
"test" (and (bufferp printer) printer) "sh"
"-c" "od -v /dev/zero|dd bs=1 count=100k")))
(set-process-filter process `(lambda (process string)
(test-filter process string
',printer)))
(set-process-sentinel process `(lambda (process string)
(test-sentinel process string
',printer ',finish)))
process))
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2004-01-05 23:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-16 1:21 Fix for slow process output processing (please test) Kim F. Storm
2003-12-16 2:14 ` David Kastrup
2003-12-16 3:34 ` David Kastrup
2003-12-16 10:23 ` Kim F. Storm
2003-12-16 11:51 ` David Kastrup
2003-12-16 13:24 ` Kim F. Storm
2004-01-03 15:12 ` David Kastrup
2004-01-04 23:00 ` Kim F. Storm
2004-01-03 22:07 ` Eric Hanchrow
2004-01-04 22:42 ` Kim F. Storm
2004-01-05 15:57 ` David Kastrup
2004-01-05 19:09 ` Eli Zaretskii
2004-01-05 19:39 ` David Kastrup
2004-01-05 19:52 ` Jason Rumney
2004-01-05 23:28 ` Kim F. Storm [this message]
2004-01-05 23:16 ` Jason Rumney
2004-01-05 23:44 ` David Kastrup
2004-01-06 0:23 ` Jason Rumney
2004-01-07 0:40 ` Kim F. Storm
2004-01-05 23:35 ` Kim F. Storm
2004-01-05 22:50 ` David Kastrup
2004-01-06 0:09 ` Kim F. Storm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ptdy7z5y.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=dak@gnu.org \
--cc=eliz@elta.co.il \
--cc=emacs-devel@gnu.org \
--cc=offby1@blarg.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).