Re: [hackers] [sbase] [PATCH 04/11] Don't use buffered IO (fread) when not appropriate

From: Laslo Hunhold <dev_AT_frign.de>
Date: Tue, 27 Dec 2016 14:36:42 +0100

On Tue, 6 Dec 2016 02:16:56 -0800
Michael Forney <mforney_AT_mforney.org> wrote:

Hey Michael,

> fread reads the entire requested size (BUFSIZ), which causes tools to
> block if only small amounts of data are available at a time. At best,
> this causes unnecessary copies and inefficiency, at worst, tools like
> tee and cat are almost unusable in some cases since they only display
> large chunks of data at a time.

sbase uses FILE-pointers exclusively and mixing both "logics" is not
very helpful for the clarity of the expressed code.
The writeall() function looks like an util function that could be
introduced to completely convert sbase from fp to fd stream handling.

I think this is not the place here to discuss this, but I would be glad
if you could create a new thread here on hackers_AT_ where you give some
examples where buffered IO is problematic.
The necessity to add functions like fshut() really made me think twice
about the advantages of buffered IO.

Cheers

Laslo

-- 
Laslo Hunhold <dev_AT_frign.de>
Received on Tue Dec 27 2016 - 14:36:42 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 27 2016 - 15:16:14 CET