From: Dave Taht <dave.taht@gmail.com>
To: Cake List <cake@lists.bufferbloat.net>
Subject: [Cake] an experiment with an alternate hasher
Date: Sun, 26 Mar 2017 09:00:34 -0700 [thread overview]
Message-ID: <CAA93jw5AJHB+=7LyP9EArNCNjO5eFNsuuEOY8QN-Epg5O6cy1A@mail.gmail.com> (raw)
I am trying to see if I can get an adaquate avalanche distribution using
a hash of popcount(src),(popcount(dst),srcport,dstport, protocol, seed.
popcount is, regrettably, an sse4.2-only instruction, and this version
of the assembly routine can actually popcount up to 8 ipv6 addresses
in a row, but you typically just pass it 2. I had a great deal of fun
writing this tho I haven't got around to actually seeing how good a
resulting hash would be!
The ipv4 version does both src and dst with a single popcnt.
The startup cost to further hash this is pretty insane - 30 cycles in
http://burtleburtle.net/bob/hash/spooky.html. Xor? CRC?
00000000004005a0 <popcount2asm>:
4005a0: 31 c0 xor %eax,%eax
4005a2: 89 f1 mov %esi,%ecx
00000000004005a4 <poploop7>:
4005a4: 48 c1 e0 08 shl $0x8,%rax
4005a8: f3 4c 0f b8 07 popcnt (%rdi),%r8
4005ad: 48 83 c7 10 add $0x10,%rdi
4005b1: 4c 09 c0 or %r8,%rax
4005b4: f3 4c 0f b8 47 f8 popcnt -0x8(%rdi),%r8
4005ba: 4c 01 c0 add %r8,%rax
4005bd: e2 e5 loop 4005a4 <poploop7>
4005bf: c3 retq
--
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org
next reply other threads:[~2017-03-26 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 16:00 Dave Taht [this message]
2017-03-26 16:16 ` Jonathan Morton
2017-03-26 16:37 ` Dave Taht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAA93jw5AJHB+=7LyP9EArNCNjO5eFNsuuEOY8QN-Epg5O6cy1A@mail.gmail.com' \
--to=dave.taht@gmail.com \
--cc=cake@lists.bufferbloat.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox