Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2015 00:30:24 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        David Chisnall <theraven@FreeBSD.org>
Cc:        Poul-Henning Kamp <phk@phk.freebsd.dk>, Baptiste Daroussin <bapt@FreeBSD.org>, current@FreeBSD.org
Subject:   Re: Increase BUFSIZ to 8192
Message-ID:  <20150514073024.GW37063@funkthat.com>
In-Reply-To: <A1224018-7540-4C76-91EF-AEA2655E49A8@FreeBSD.org>
References:  <20150511230635.GA46991@ivaldir.etoilebsd.net> <20150512032307.GP37063@funkthat.com> <14994.1431412293@critter.freebsd.dk> <20150513080342.GE37063@funkthat.com> <A1224018-7540-4C76-91EF-AEA2655E49A8@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
David Chisnall wrote this message on Wed, May 13, 2015 at 09:27 +0100:
> On 13 May 2015, at 09:03, John-Mark Gurney <jmg@funkthat.com> wrote:
> > 
> > Poul-Henning Kamp wrote this message on Tue, May 12, 2015 at 06:31 +0000:
> >> --------
> >> In message <20150512032307.GP37063@funkthat.com>, John-Mark Gurney writes:
> >> 
> >>> Also, you'd probably see even better performance by increasing the
> >>> size to 64k, [...]
> >> 
> >> easy:
> >> 	8K on 32bit
> >> 	64k on 64bit
> > 
> > Sounds good to me...  Just for people who care... I did a quick set of
> > benchmarks on sha256.. This is using my preliminary patch to use sse4
> > optimized sha256...  But this should be the same for others...
> > 
> > The numbers in ministat output are the time in seconds it takes my
> > 3.4GHz AMD A10-5700 APU running HEAD to process a 512MB file, so lower
> > numbers are better..  I've processed them into easier to read format:
> > BUFSIZ:	145MB/sec
> > 8k:	193MB/sec
> > 16k:	198MB/sec
> > 64k:	202MB/sec
> > 128k:	202MB/sec
> > -t:	211MB/sec
> 
> It looks like most of the benefit is gained at 16KB.  Did you try running the benchmark with something else running at the same time to see if there is any advantage in trashing the caches a bit less (simple case, what happens if you run two instances of the same benchmark at once)?
> 
> I suspect that you???re about right anyway - I recently did some tests while playing with JavaScript FFI generation with a multithreaded process JavaScript environment calling out to OpenSSL to do SHA calculations and having each of 8 threads reading in 128KB chunks gave the fastest performance (Core i7, 4 cores + hyperthreading), with only a negligible gain over 64KB.  In all cases, the JavaScript implementation was significantly faster than the openssl tool, which used 8KB buffers.

Just in case anyone else wants to know how to run benchmarks
themselves..  Go into /usr/src/lib/libmd, edit mdXhl.c, and change
the occurence of BUFSIZ to what you want to test, say 64*1024, run:
make all && make install

and then you can run programs like sha256 -t, or:
for i in `jot 5 1`; do /usr/bin/time sha256 test.file ; done 2> XXX.times

Where test.file is populated maybe like:
dd if=/dev/urandom of=test.file bs=1m count=512

Then run:
ministat XXX.times YYY.times

to compare multiple results...

Happy benchmarking!

-- 
  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?20150514073024.GW37063>