From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Noonan Subject: Re: Linus' sha1 is much faster! Date: Mon, 17 Aug 2009 08:44:30 -0700 Message-ID: References: <4A85F270.20703@draigBrady.com> <87eirbef3c.fsf@master.homenet> <4A88B80D.40804@draigBrady.com> <8763cmemsa.fsf@master.homenet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?ISO-8859-1?Q?P=E1draig_Brady?= , Bug-coreutils@gnu.org, Linus Torvalds , Git Mailing List To: Giuseppe Scrivano X-From: git-owner@vger.kernel.org Mon Aug 17 17:44:44 2009 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1Md4Ny-0001oC-L5 for gcvg-git-2@lo.gmane.org; Mon, 17 Aug 2009 17:44:39 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753722AbZHQPoa convert rfc822-to-quoted-printable (ORCPT ); Mon, 17 Aug 2009 11:44:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753580AbZHQPoa (ORCPT ); Mon, 17 Aug 2009 11:44:30 -0400 Received: from mail-yw0-f173.google.com ([209.85.211.173]:50108 "EHLO mail-yw0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753469AbZHQPoa convert rfc822-to-8bit (ORCPT ); Mon, 17 Aug 2009 11:44:30 -0400 Received: by ywh3 with SMTP id 3so4219868ywh.22 for ; Mon, 17 Aug 2009 08:44:31 -0700 (PDT) Received: by 10.91.141.6 with SMTP id t6mr2882874agn.49.1250523870689; Mon, 17 Aug 2009 08:44:30 -0700 (PDT) In-Reply-To: <8763cmemsa.fsf@master.homenet> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Mon, Aug 17, 2009 at 3:51 AM, Giuseppe Scrivano w= rote: > P=E1draig Brady writes: > >> =A0 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=3D2 -fexceptions >> =A0 -fstack-protector --param=3Dssp-buffer-size=3D4 -m32 -march=3Di5= 86 >> =A0 -mtune=3Dgeneric -fasynchronous-unwind-tables -D_GNU_SOURCE=3D1 > > thanks. =A0I did again all tests on my machine using these same optio= ns. > I repeated each test 6 times and I took the median without consider t= he > first result. =A0Except the first run that it is not considered, I di= dn't > report a big variance on results of the same test. > > > gcc 4.3.3 > > gnulib sha1: =A0 =A0 =A0 =A0 =A0 =A0real =A0 =A00m2.543s > gnulib sha1 lookup: =A0 =A0 real =A0 =A00m1.906s (-25%) > linus's sha1: =A0 =A0 =A0 =A0 =A0 real =A0 =A00m2.468s (-3%) > linus's sha1 no asm: =A0 =A0real =A0 =A00m2.289s (-9%) > > > gcc 4.4.1 > > gnulib sha1: =A0 =A0 =A0 =A0 =A0 =A0real =A0 =A00m3.386s > gnulib sha1 lookup: =A0 =A0 real =A0 =A00m3.110s (-8%) > linus's sha1: =A0 =A0 =A0 =A0 =A0 real =A0 =A00m1.701s (-49%) > linus's sha1 no asm: =A0 =A0real =A0 =A00m1.284s (-62%) > > > I don't see such big differences in asm generated by gcc 4.4.1 and gc= c > 4.3.3 to explain this performance difference, what I noticed immediat= ely > is that in the gcc-4.4 generated asm there are more "lea" instruction= s > (+30%), but I doubt this is the reason of these poor results. =A0Anyw= ay, I > haven't yet looked much in details. > > Cheers, > Giuseppe Interesting. I compared Linus' implementation to the public domain one by Steve Reid[1], which is used in OpenLDAP and a few other projects. Anyone with some experience testing these kinds of things in a statistically sound manner want to try it out? In my tests, I got this: (average of 5 runs) Linus' sha1: 283MB/s Steve Reid's sha1: 305MB/s - Steven [1] http://gpl.nas-central.org/SYNOLOGY/x07-series/514_UNTARED/source/o= penldap-2.3.11/libraries/liblutil/sha1.c