This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] libio: Always use 8192 bytes as the default buffer size [BZ #4099]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 4 Mar 2016 10:17:16 +0100
- Subject: Re: [PATCH] libio: Always use 8192 bytes as the default buffer size [BZ #4099]
- Authentication-results: sourceware.org; auth=none
- References: <56D08C7C dot 9080806 at redhat dot com> <20160303233335 dot 9EA262C3BE9 at topped-with-meat dot com>
On 03/04/2016 12:33 AM, Roland McGrath wrote:
> I think this should be split up and separate parts of it discussed
> separately.
>
> First, let's talk about the rationale for the wfiledoalloc.c changes.
> Removing the unused cruft #include's and wrong comment are clearly fine.
> Those don't belong with a functional change. Just do those first by
> themselves.
You are right, I 'll separate this part and commit it.
> You haven't described the rationale for using the narrow buffer size as the
> byte size of the wide buffer. The existing rationale is fairly obvious:
> each wchar_t might correspond to as few bytes as one, so multiplying the
> narrow buffer size by sizeof (wchar_t) ensures that the wide buffer is
> always big enough to contain the same file data as is the narrow buffer.
Then why don't we do this for a user-supplied buffer?
> What is bad about that rationale and what is your better rationale for
> making the two sizes equal?
I can skip this part. I wanted to avoid the substantial memory
allocation (32768 bytes). I doubt that performance increases with a
larger buffer because it approaches the size of typical first-level caches.
We can post-pone the wide changes. The important change is the fix for
bug 4099. Do you think this is controversial as well? libstdc++
already uses a buffer size of 8192 for its streams (or 8191, depending
on how you look at it).
Florian