-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jakub Zawadzki
Sent: den 22 april 2010 15:40
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] RFC: sorted value_string + bsearch

On Tue, Apr 20, 2010 at 11:43:49PM +0200, Anders Broman wrote:
>> Would it be faster to use hash tables instead of very large 
>> value_strings? In diameter i think 3gpp AVP codes are in a 
>> value_string > 2k
>
>I think main problem with hash tables, is that you need to have big table, and 
>good hash function.
>
>
>Binary search is O(log2 n), so for 5k we have at most 13 lookups.
>To achieve it with hash table we need 384 (5000/13) buckets (HASHPORTSIZE in 
>addr_resolv.c is only 256).
>
>And I think it's hard to implement hash tables, using current value_string ABI.
>
>Cheers.
Disclaimer: Hobby C programmer :-)

A crude sketch:
I was hoping it would be possible to provide a pointer to the hash table like:
-       { &hf_diameter_vendor_id,
-                 { "VendorId", "diameter.vendorId", FT_UINT32, BASE_DEC, 
VALS(sminmpec_values),
-                         0x0,NULL, HFILL }},
+       { &hf_diameter_vendor_id,
+                 { "VendorId", "diameter.vendorId", FT_UINT32, BASE_DEC, 
HASH_VALS(hastablep),
+                         0x0,NULL, HFILL }},

Use g_hastable_new_full() gint version and stuff the value_string into the hash 
table
In proto_register, then have proto.c extract the value. Alternatively we could 
perhaps
Pass a "get_value" function pointer?
 I'm not sure this will work :-)

Regards
Anders
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to