Wireshark-bugs: [Wireshark-bugs] [Bug 3973] New: addresse hash is slow on little endian CPU.

Date: Tue, 1 Sep 2009 20:21:39 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3973

           Summary: addresse hash is slow on little endian CPU.
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: dgautheron@xxxxxxxx


Build Information:
Paste the COMPLETE build information from "Help->About Wireshark", "wireshark
-v", or "tshark -v".
--
Hi,
In epan/addr_resolv.c
The hostname cache uses the hash:
#define HASH_IPV4_ADDRESS(addr)        ((addr) & (HASHHOSTSIZE - 1))

On little endian CPU (x86) it's slow because addr is in host order thus 
'(addr) & (HASHHOSTSIZE - 1)' returns the network not the host.

I've found it while working on a capture with a lot of hosts, my old G4 (big
endian) was faster than a newer Pentium. As always O(n^2) beats Moore law.

Use
HASH_IPV4_ADDRESS(addr) (ipv4_get_net_order_addr(addr) & (HASHHOSTSIZE - 1))
or
HASH_IPV4_ADDRESS(addr) (g_htnol(addr) & (HASHHOSTSIZE - 1))

?

Didier


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.