From owner-freebsd-net@FreeBSD.ORG Sat Aug 31 00:05:03 2013 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 28D44731; Sat, 31 Aug 2013 00:05:03 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [IPv6:2a00:1450:4010:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BCA2528D8; Sat, 31 Aug 2013 00:05:01 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id eh20so2035237lab.18 for ; Fri, 30 Aug 2013 17:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=JFxNqLmO9Al4PmG9V9J0Y+zFkCpcJ9iXICzugC7dKMQ=; b=oqwp2eBdnK8bHRD7KdCI1dmpprRWH0Nh3fN5VxfjPY56xoa427DB2ynTtLQ5uiXPGw P2gZMIvByNPfiVQtKoJqSbm8YkiFUzTHmn0Lp+OquVgpCHvnZJ8eyck/rVPtCiUuQ9Yt szQLxaYb4hMru8hx+zE0uYtcv5yvkoaDSJWQSAsjA9GCfZMYjUZOvrvRmXt0UE3P6ST+ NJD5AAsbxThBpenKMprQM3/1KgKTnJRRjOmCrBoWfRNBtSQwTMeWw4Qn4kUU2NOJaKET j58uZZ8yE3wlUqmQcmEuxqfdl+3Q9h/25mJM08vRbEEeFUPMZ0wGQ4v2JHhg7M+ZRA5D A3Zw== MIME-Version: 1.0 X-Received: by 10.112.14.102 with SMTP id o6mr9757380lbc.28.1377907499050; Fri, 30 Aug 2013 17:04:59 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.200.165 with HTTP; Fri, 30 Aug 2013 17:04:58 -0700 (PDT) In-Reply-To: References: <521BBD21.4070304@freebsd.org> <521EE8DA.3060107@freebsd.org> Date: Sat, 31 Aug 2013 02:04:58 +0200 X-Google-Sender-Auth: nP5sj5JRm-M4YdVnQI6x6G9HdPc Message-ID: Subject: Re: Flow ID, LACP, and igb From: Luigi Rizzo To: Alan Somers Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Jack F Vogel , "net@freebsd.org" , "Justin T. Gibbs" , Andre Oppermann , "T.C. Gubatayao" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Aug 2013 00:05:03 -0000 Alan, On Thu, Aug 29, 2013 at 6:45 PM, Alan Somers wrote: > > > ... > I pulled all four hash functions out into userland and microbenchmarked > them. The upshot is that hash32 and fnv_hash are the fastest, jenkins_hash > is slower, and siphash24 is the slowest. Also, Clang resulted in much > faster code than gcc. > > i missed this part of your message, but if i read your code well, you are running 100M iterations and the numbers below are in seconds, so if you multiply the numbers by 10 you have the cost per hash in nanoseconds. What CPU did you use for your tests ? Also some of the numbers (FNV and hash32) are suspiciously low. I believe that the compiler (both of them) have figure out that everything is constant in these functions, and fnv_32_buf() and hash32_buf() are inline, hence they can be optimized to just return a constant. This does not happen for siphash and jenkins because they are defined externally. Can you please re-run the tests in a way that defeats the optimization ? (e.g. pass a non constant argument to the the hashes so you actually need to run the code). cheers luigi http://people.freebsd.org/~asomers/lagg_hash/ > > [root@sm4u-4 /usr/home/alans/ctest/lagg_hash]# ./lagg_hash-gcc-4.8 > FNV: 0.76 > hash32: 1.18 > SipHash24: 44.39 > Jenkins: 6.20 > [root@sm4u-4 /usr/home/alans/ctest/lagg_hash]# ./lagg_hash-gcc-4.2.1 > FNV: 0.74 > hash32: 1.35 > SipHash24: 55.25 > Jenkins: 7.37 > [root@sm4u-4 /usr/home/alans/ctest/lagg_hash]# ./lagg_hash.clang-3.3 > FNV: 0.30 > hash32: 0.30 > SipHash24: 55.97 > Jenkins: 6.45 > [root@sm4u-4 /usr/home/alans/ctest/lagg_hash]# ./lagg_hash.clang-3.2 > FNV: 0.30 > hash32: 0.30 > SipHash24: 44.52 > Jenkins: 6.48 > > > > > T.C. > > > > [1] > > > http://svnweb.freebsd.org/base/head/sys/libkern/jenkins_hash.c?view=markup > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >