Re: [fossil-users] MD5 and SHA1 from OpenSSL
On Thu, Sep 01, 2011 at 07:43:56PM +0200, Dmitry Chestnykh wrote: My simple performance test of SHA-1 from checkin [f2ede7da6d] vs OpenSSL shows that the latter is a bit faster: When I ported the NetBSD implementation, I was considering using OpenSSL. The discussion with Richard was essentially that the performance benefit on known architectures is small enough to be irrelevant. This is further aggrevated by the inconsistent performance of OpenSSL. If you can demonstrate a platform where the delta is huge, it wouldn't be difficult to change (as this patch shows). I'm not even aware of a non-crippled SHA1 hardware implementation. The VIA PadLock support is kind of screwed, so I am not even sure if it would apply for this case. Joerg ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] MD5 and SHA1 from OpenSSL
Maybe it depends on your specific hardware, but on linux32 (i3 core2) I get (kubuntu11-04.iso) : openssl sha1 : 3.823 fossil sha1sum : 3.660 (old fossil: 4.936) On linux64 (amd athlon X2, using a 600M data file): openssl sha1 : 2.504 fossil sha1sum : 3.202 (old fossil: 4.211) (these are best times from a number of runs) Clearly, the new code is much better than the old code; but it's not clear the openssl code is always a win... I'm not sure whether or not it's a good idea to try to determine at run time which to use (since the check overhead has to be measurable after all). On 09/01/2011 08:43 PM, Dmitry Chestnykh wrote: I noticed the recent effort to optimize SHA-1 in Fossil, and it crossed my mind that we can use OpenSSL implementation (which seem to be heavily optimized), since we already link it when FOSSIL_ENABLE_SSL is defined, and fall back to the current implementation if Fossil is not linked without OpenSSL. My simple performance test of SHA-1 from checkin [f2ede7da6d] vs OpenSSL shows that the latter is a bit faster: $ time ./fossil sha1sum ~/Downloads/FreeBSD-8.2-RELEASE-i386-disc1.iso Current implementation: real 0m3.549s user 0m3.232s sys 0m0.315s OpenSSL implementation: real 0m3.017s user 0m2.699s sys 0m0.316s Compiler: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) The diff is very simple -- just a couple of defines; I have attached it. -- Dmitry Chestnykh ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] MD5 and SHA1 from OpenSSL
Maybe it depends on your specific hardware, but on linux32 (i3 core2) I get (kubuntu11-04.iso) : Yay, good then, no need to use OpenSSL. I suspect this is due to LLVM backend of OS X compiler which is default in Lion. For some crypto code I've written it compiles binaries that are slower than the ones produced by the old GCC 4.2. Clearly, the new code is much better than the old code; Good job! but it's not clear the openssl code is always a win... I'm not sure whether or not it's a good idea to try to determine at run time which to use (since the check overhead has to be measurable after all). Yes, let's leave it as it is. -- Dmitry Chestnykh ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] MD5 and SHA1 from OpenSSL
Not so fast! :) It seems that the current code is faster than openssl on intel (well, on linux anyway). But it is slower on AMD chips, whether 32 or 64 bit os. That is something which is easily detectable, although I don't know if I have the patience to try to figure out what is going on to make the performance on AMD so much slower (relative to openssl). Possibly it could be interesting to let gcc 'tune' for amd vs intel and see if it makes a difference... On 09/01/2011 09:20 PM, Dmitry Chestnykh wrote: Yes, let's leave it as it is. ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] MD5 and SHA1 from OpenSSL
Given that one of fossil's selling points is ease of installation, including having no external dependencies. Let's not change that. I agree, but I proposed (and the retracted) that OpenSSL will be used only when compiled with SSL support ;-) -- Dmitry Chestnykh ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] MD5 and SHA1 from OpenSSL
BTW, if I run `openssl sha1`, it's slower than Fossil's sha1test compiled with OpenSSL SHA-1: openssl sha1: real0m3.459s user0m3.126s sys 0m0.317s fossil with OpenSSL's SHA1 from my diff: real0m3.025s user0m2.707s sys 0m0.315s current fossil trunk: real0m3.557s user0m3.236s sys 0m0.317s $ openssl version OpenSSL 1.0.0d 8 Feb 2011 I have Core 2 Duo 2.26 GHz (white unibody MacBook), OS X 10.7.1 Maybe the command-line openssl does something else? -- Dmitry Chestnykh ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users