FAQ

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

Search Discussions

  • Nicholas Clark at May 27, 2013 at 12:22 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedMay 27, '13 at 12:17p
activeMay 27, '13 at 12:22p
posts2
users2
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase