[PATCH] Do not break buffers in fvwrite for unbuffered files
Federico Terraneo
fede.tft@hotmail.it
Thu Oct 31 09:53:00 GMT 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/21/2013 05:36 PM, Corinna Vinschen wrote:
> On Oct 21 16:15, Federico wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> On 10/21/2013 02:47 PM, Corinna Vinschen wrote:
>>>
>>> Maye it makes sense to use the largest multiple of BUFSIZ <=
>>> MAX_INT. See below.
>>>>
>>>> I'm wondering if it makes sense to avoid splitting writes
>>>> (and reads) also for buffered files. glibc appears to do it,
>>>
>>> Buffered writes are already split into fp->_bf._size chunks.
>>> Glibc basically uses the largest multiple of fp->_bf._size <=
>>> len instead. We could do the same. Would you like to create a
>>> patch for that?
>>
>> I'll have a look at what can be done in the next days.
>
> Thanks!
Sorry for the delay, I've been quite busy.
Anyway, here's the patch that makes both unbuffered and fully buffered
writes faster. It writes in multiples of fp->_bf._size, and clamps at
INT_MAX, as requested.
Here's the changelog entry:
2013-10-31 Terraneo Federico <fede.tft@hotmail.it>
* libc/stdio/fvwrite.c: Allow writing in multiples of
fp->_bf._size for fully buffered and unbuffered files,
to improve write performance.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJScih7AAoJECkLFtN5Xr9fXQoIALOk290GUWA3YvT1b+UkSf+Y
RXEGK2kX0IGMrZu8Affq2VX2wbudKFKBktZFhTaUmjo3e9whmDz1S3+CQJhpndpu
FrJdy//v5Z1A/+nDy2oI1y7xiOO8c8DbhU+S5AlOh09uTXXxthW/Rw8yB4Qhj5/B
mu02savYNM38e7lgjr+Dly2Gyg768lpqUx3yMRVKfB6yLOpOOCObaIwqDEdYVHnO
QbvNMx4QeoglWEOo3mBTJa8eja16an4MVGbte2SmaMDODU337tPoe/Cv8TpKQfj2
THtU62CnNT6UVBPxaRcsoCnHqyNirZ/tvnofDkRidaBSbLi7oF4M7JcRe+Hx3p4=
=iRfH
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fvwrite.patch
Type: text/x-patch
Size: 1851 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20131031/0ef03a21/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fvwrite.patch.sig
Type: application/octet-stream
Size: 287 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20131031/0ef03a21/attachment.obj>
More information about the Newlib
mailing list