From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Fix for slow process output processing (please test). Date: 06 Jan 2004 00:28:57 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <87y8so7kjy.fsf@offby1.atm01.sea.blarg.net> <2914-Mon05Jan2004210950+0200-eliz@elta.co.il> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073342552 22662 80.91.224.253 (5 Jan 2004 22:42:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Jan 2004 22:42:32 +0000 (UTC) Cc: offby1@blarg.net, Eli Zaretskii , David Kastrup , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jan 05 23:42:28 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AddQa-00044x-00 for ; Mon, 05 Jan 2004 23:42:28 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AddQa-0007UD-00 for ; Mon, 05 Jan 2004 23:42:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdeKX-0003pd-7q for emacs-devel@quimby.gnus.org; Mon, 05 Jan 2004 18:40:17 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AdeEs-0001Yu-0q for emacs-devel@gnu.org; Mon, 05 Jan 2004 18:34:26 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AdeBc-0000KE-9s for emacs-devel@gnu.org; Mon, 05 Jan 2004 18:31:35 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdeB5-0000AJ-UY; Mon, 05 Jan 2004 18:30:32 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 3C66E47FF5A; Mon, 5 Jan 2004 23:28:53 +0100 (CET) Original-To: Jason Rumney In-Reply-To: Original-Lines: 81 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19024 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19024 Jason Rumney writes: > "Eli Zaretskii" writes: > > > > From: David Kastrup > > > 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 http://www.cua.dk