Date: Sat, 31 Aug 2013 02:04:58 +0200 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Alan Somers <asomers@freebsd.org> Cc: Jack F Vogel <jfv@freebsd.org>, "net@freebsd.org" <net@freebsd.org>, "Justin T. Gibbs" <gibbs@freebsd.org>, Andre Oppermann <andre@freebsd.org>, "T.C. Gubatayao" <tgubatayao@barracuda.com> Subject: Re: Flow ID, LACP, and igb Message-ID: <CA%2BhQ2%2BhgTaK1ZCOLGVFjSPY8nyNPHK4waSecyRQxR1gQcyjztg@mail.gmail.com> In-Reply-To: <CAOtMX2h5SGh5eYV50y%2BQB_s367V9iattGU862wwXcONDV%2BTG8g@mail.gmail.com> References: <D01A0CB2-B1E3-4F4B-97FA-4C821C0E3FD2@FreeBSD.org> <521BBD21.4070304@freebsd.org> <CAOtMX2jvKGY==t9i-a_8RtMAPH2p1VDj950nMHHouryoz3nbsA@mail.gmail.com> <521EE8DA.3060107@freebsd.org> <BCC2C62D4FE171479E2F1C2593FE508B0BE24383@BN-SCL-MBX03.Cudanet.local> <CAOtMX2h5SGh5eYV50y%2BQB_s367V9iattGU862wwXcONDV%2BTG8g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Alan, On Thu, Aug 29, 2013 at 6:45 PM, Alan Somers <asomers@freebsd.org> 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" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2BhgTaK1ZCOLGVFjSPY8nyNPHK4waSecyRQxR1gQcyjztg>