From: Mark H Weaver <mhw@netris.org>
To: ludo@gnu.org (Ludovic Courtès)
Cc: Andy Wingo <wingo@pobox.com>, guile-devel <guile-devel@gnu.org>
Subject: Re: Making custom binary input ports unbuffered
Date: Wed, 15 Jan 2014 00:43:05 -0500 [thread overview]
Message-ID: <87k3e1vlzq.fsf@netris.org> (raw)
In-Reply-To: <878uuiyxsb.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 15 Jan 2014 00:00:04 +0100")
Hi Ludovic,
ludo@gnu.org (Ludovic Courtès) writes:
> As discussed on IRC, our R6 custom binary input ports (CBIPs) are
> currently buffered. The buffer is hard-coded and setvbuf doesn’t work
> on non-file ports.
[...]
> The patch below makes CBIPs unbuffered (see the tests for the properties
> it gives.) It works thanks to the optimization in ‘scm_c_read’ for
> unbuffered binary ports.
When you say "It works thanks to the optimization in 'scm_c_read'", do
you mean that something will be broken if another method of reading is
used?
I think it's important that everything that currently works keeps on
working, even if less efficiently.
> This is going to be a performance hit for applications that read things
> byte by byte, *or* via textual procedures (‘scm_getc’, ‘get-string’,
> etc.) But the assumption is that people rather use ‘get-bytevector-n’
> (or similar) to get a chunk of data.
>
> However! There are places in (web ...) where CBIPs are used for mixed
> binary/textual input. When that happens, all the accesses end up being
> unbuffered, which really sucks.
>
> So, what do we do? :-)
While I agree that CBIPs should be unbuffered by default, I think it's
important to have a way to enable buffering, even if it's not portable.
Also, I think we should make R6RS custom binary _output_ ports
unbuffered by default as well, and we should have a way to enable
buffering on them.
Thanks for looking into this!
Mark
next prev parent reply other threads:[~2014-01-15 5:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 23:00 Making custom binary input ports unbuffered Ludovic Courtès
2014-01-15 5:43 ` Mark H Weaver [this message]
2014-01-15 11:48 ` Ludovic Courtès
2014-01-15 22:51 ` Ludovic Courtès
2014-01-16 0:15 ` Mark H Weaver
2014-01-16 23:00 ` Ludovic Courtès
2014-01-18 21:57 ` Ludovic Courtès
2014-01-21 7:41 ` Mark H Weaver
2014-01-21 10:50 ` Ludovic Courtès
2014-01-21 14:46 ` Mark H Weaver
2014-01-21 17:37 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k3e1vlzq.fsf@netris.org \
--to=mhw@netris.org \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).