This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libio: Always use 8192 bytes as the default buffer size [BZ #4099]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]