Wireshark-bugs: [Wireshark-bugs] [Bug 8467] Need functions to mirror val_to_str

Date: Tue, 19 Mar 2013 09:55:43 +0000

Comment # 5 on bug 8467 from
(In reply to comment #4)
> (In reply to comment #2)

> That's done for speed so perhaps a string matching function should use
> hastables internally at least over a certain stringtable size.

That's one of the most elegant and efficient lookup method...but
But I think on nowadays CPU it's value is felt by the end user only if the
number of string among we do the search is quite hight...(let's say 1000 just
to have a ball park figure).
Beside that every dissector should has it's own string space table, reducing
the size of the "dictionary" where we are looking for the match, so as function
matching string to value has not to be used in other context, maybe
implementing a hash table could be more than actually needed (of course with
strcmp and cycling over all strings to be matched time complexity of the
resulting function definitely worse). If the existing code already provides a
hash table API, of course that's probably the right choice otherwise...I don't
know if it worths. 
A solution that sits in the middle should be sorting all the strings value (if
they are a lot, as the sorting array takes additional space in memory, need to
be allocated and freed) and then use strcmp with dichotomic search to reduce
the number of call to strcmp function and speed up a bit things :)
Ciao
Seba


You are receiving this mail because:
  • You are watching all bug changes.