develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #57258] :perlio layer extra FLUSHes

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 27, 2013 12:22
Subject:
Re: [perl #57258] :perlio layer extra FLUSHes
Message ID:
20130527122159.GC3729@plum.flirble.org
On Mon, May 27, 2013 at 05:17:34AM -0700, Leon Timmermans via RT wrote:
> On Thu Jul 24 18:21:26 2008, kryde wrote:
> > The program below prints
> > 
> >     WRITE 4096 bytes
> >     FLUSH
> >     WRITE 4096 bytes
> >     FLUSH
> >     WRITE 4096 bytes
> >     FLUSH
> >     WRITE 4096 bytes
> >     FLUSH
> > 
> > where I hoped the :perlio layer wouldn't call Flush on the sub-layer
> > unless/until a flush from the toplevel.
> > 
> > Nosing around it looks like the :perlio code for "my buffer is full, I
> > have to write it to the sublayer" calls its own flush func to do that
> > job, resulting in what I think are unnecessary Flushes on the
> >    sublayer.
> > 
> > The commented-out ":encoding(ascii)" line in the program does the same
> > thing, but in 1024 byte blocks.  Nosing around I guess :encoding
> >    shares
> > some of the buffering layer code.
> > 
> > (This is assuming I understand the flush func correctly as meaning
> > "force output sofar to go on the wire, if it hasn't already".  The
> > perliol pod isn't quite as clear as it might be.)
> 
> Yeah, this is because flush is a little too overloaded. It's suboptimal
> but not really wrong (as is much in PerlIO).

Gosh yes, sorry I missed this at the time.
(I'd just moved job and was moving house)

I remember commenting this to Nick Ing-Simmons - that flush is used to mean
both "regular empty the buffer" and "urgent, to the disk, now!", and IIRC he
agreed that it was a design mistake.

I don't think that we can fix this without a major rewrite of PerlIO.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About