>>There is a certain level of urgency on shaking well our PerlIO demands,
 >>because 5.8.0 seems to come out any moment now. And it'll really suck if
 >>there will be changes needed once 5.8.0 is released. I wish apr folks
 >>would answer my question about exposing the apr's read buffer, so we can
 >>figure out how to do the buffered reads.
 >>
 >
 > i thought PerlIO has a buffer layer (PerlIOBuf?), where it would read a
 > chunk from the lower layer and take care of the buffering.  this is how
 > must io-systems work, apache has a buffering filters, SSL has a buffer
 > BIO, etc.


Yes, that requires the lower layer's cooperation (which I cannot get),
i.e. access to its buffer. Here is an excerpt from my private discussion
with Nick Ing-Simmons:

  > If so, Do I need to implement a buffer in
  > PerlIOAPR? The thing is that APR itself does the buffering so I see no
  > reason for adding more overhead.

True enough - in which case what is best depends on whether
you can snoop the buffer it provides.

If you can snoop it provide your own get_base et. al. which do the snooping.
If you cannot you have two options which you need to experiment
with:

A. Do what you have (accidentally) done already and say there is no
     fast interface and live with sv_gets calling your read 1 char at
     a time.
B. Provide an (additional) PerlIOBuf_ buffer layer.

Which is faster depends on how slow APR's read is...

  > I do have the buffering
  > on the APR level. Wouldn't it make things even simpler, since I don't
  > need to find a way to snoop on internal buffer. (I've looked at the
  > APR's file API and I cannot get to the internal buffer).

That is going to be a pain. How much can you "unget" ?
The problem is that
$/ = "--- FooBar ---\n";
$block = <$fh>;

Has to read ahead quite a bit to be _sure_ this is the record separator.
Normally it does that by snooping the buffer. If it cannot do that
it reads 1-char-at-a-time because ANSI C stdio only defines ungetc()
for one character. Now a PerlIO * stream can "unread" as much as
we like, but there has never been a need to teach sv_gets() that as
we choose a snoopable buffer layer.




_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to