Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: stream buffering



On Thu, 17 Feb 2011 19:40:20 -0600 (CST)
Rory Mulvaney <rorymulv@xxxxxxxxx> 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 <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author