Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 May 2015 20:23:07 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: Increase BUFSIZ to 8192
Message-ID:  <20150512032307.GP37063@funkthat.com>
In-Reply-To: <20150511230635.GA46991@ivaldir.etoilebsd.net>
References:  <20150511230635.GA46991@ivaldir.etoilebsd.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150512032307.GP37063>