From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29438 invoked by alias); 18 Feb 2011 21:33:36 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15811 Received: (qmail 15643 invoked from network); 18 Feb 2011 21:33:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.56 as permitted sender) Date: Fri, 18 Feb 2011 20:55:51 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: stream buffering Message-ID: <20110218205551.61fb9fb4@pws-pc.ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.0; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=56eA6W6TKPXhKfzAEK0A:9 a=0-jUEu7Kc6ykW0MDZWgbGikH1LsA:4 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Thu, 17 Feb 2011 19:40:20 -0600 (CST) Rory Mulvaney wrote: > I'm wondering if the reason that some I/O intensive zsh shell scripts > aren't fast is mostly only because the I/O is (I think) line-buffered. > Is there a way to do full buffering of streams, or what would be the best > way to provide it? Maybe a module similar to zsh/net/socket, perhaps > using setvbuf(3)? What I/O are you referring to? The shell's own input for a script needs to be parsed and intepreted, which will be much more of a restriction than buffering except for scripts with really silly amounts of embedded text like here documents. Standard input to the shell via the read builtin etc. similarly tends to be in short chunks, likewise output via print. Input to other commands run from scripts makes its own arrangements for buffering. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/