Increase BUFSIZ to 8192
John-Mark Gurney
jmg at funkthat.com
Tue May 12 03:23:15 UTC 2015
Baptiste Daroussin wrote this message on Tue, May 12, 2015 at 01:06 +0200:
> I would like to change the default value of BUFSIZ to 8192.
>
> After testing various applications that uses BUFSIZ like changing it in libmd I
> can often see performance improvements:
>
> For example with md5(1):
> Current BUFSIZ (1024)
> 0.13 real 0.04 user 0.09 sys
> New BUFSIZ (8192)
> 0.08 real 0.04 user 0.03 sys
>
> sha256(1):
> Before:
> 0.44 real 0.39 user 0.04 sys
> After:
> 0.37 real 0.35 user 0.01 sys
>
> This is done on a small amd64 Lenovo S20 laptop
>
> Review available here:
> https://reviews.freebsd.org/D2515
personally, I think the applications that are abusing BUFSIZ should be
fixed to use a properly sized buffer for their applications... BUFSIZ
is defined for the default stdio buffer sizes...
I got significant perf improvement many years ago by fixed lpd to use
a sane BUFSIZ... And did the same recently w/ nc (bumping from 2k
to 16k, though I'd'f liked to go larger)...
Also, you'd probably see even better performance by increasing the
size to 64k, though as with all things, this means more memory use
on smaller systems (though on smaller/slower systems, this may be
an even bigger win)... This mostly just reduces number of context
switches...
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-current
mailing list