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

[perl #57258] :perlio layer extra FLUSHes

Thread Next
From:
Leon Timmermans via RT
Date:
May 27, 2013 12:17
Subject:
[perl #57258] :perlio layer extra FLUSHes
Message ID:
rt-3.6.HEAD-2650-1369657053-355.57258-15-0@perl.org
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).

Leon

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=57258

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