monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optimized SHA1 (was Re: [Monotone-devel] net.venge.monotone.experime


From: Jack Lloyd
Subject: Re: optimized SHA1 (was Re: [Monotone-devel] net.venge.monotone.experiment.performance)
Date: Sat, 5 Aug 2006 08:34:01 -0400
User-agent: Mutt/1.5.11

On Sat, Aug 05, 2006 at 05:09:01AM -0400, Jack Lloyd wrote:

> There are two basic ways I can imagine handing it - derive a new
> object from Botan's SHA_160 class and just override the hash()
> function (which implements the core transform), leaving the default
> padding/buffering code, or if you think those virtual function calls
> are causing a problem (I'd be skeptical, but who knows) and/or want to
> implement everything in asm, you can implement a completely distinct
> HashFunction object and ignore the default implementation
> completely. The engine itself would look like (completely untested
> code):

For amusement value I decided to try this (I've been desperately
avoiding doing real work all night). Essentially I generated the
OpenSSL x86 asm for ELF and wrote a wrapper class to integrate it into
Botan. Timings:

SHA-160:                    75.51 Mbytes/sec <- standard Botan
SHA-160:                   103.49 Mbytes/sec <- calling OpenSSL asm
SHA-160:                   130.78 Mbytes/sec <- OpenSSL EVP wrappers

`openssl speed sha1` best time:  135120.95k

I'm not entirely sure why the benchmarks come out better using the EVP
wrappers than directly calling the asm code. Best guess right now is
that the buffering mechanisms used in OpenSSL are smarter than the one
in Botan, but I haven't profiled it yet. Probably some optimization
opportunities for me here.

Jack




reply via email to

[Prev in Thread] Current Thread [Next in Thread]