From owner-freebsd-current@FreeBSD.ORG Tue May 12 03:23:15 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AB00417; Tue, 12 May 2015 03:23:15 +0000 (UTC) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ADB871622; Tue, 12 May 2015 03:23:14 +0000 (UTC) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t4C3N7Ek005366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 May 2015 20:23:07 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t4C3N7XQ005365; Mon, 11 May 2015 20:23:07 -0700 (PDT) (envelope-from jmg) Date: Mon, 11 May 2015 20:23:07 -0700 From: John-Mark Gurney To: Baptiste Daroussin Cc: current@freebsd.org Subject: Re: Increase BUFSIZ to 8192 Message-ID: <20150512032307.GP37063@funkthat.com> References: <20150511230635.GA46991@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150511230635.GA46991@ivaldir.etoilebsd.net> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Mon, 11 May 2015 20:23:07 -0700 (PDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 03:23:15 -0000 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."