ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] RFC: sorted value_string + bsearch

From: Jakub Zawadzki <darkjames@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Apr 2010 13:38:57 +0200
On Mon, Apr 12, 2010 at 01:20:46PM +0300, Kaul wrote:
> In some cases, wouldn't it make more sense to put the more
> commonly used string near the top and perform a normal search?

Maybe (wireshark is used in so many different environments and smth which is common in network A, might not be in network B)
I think also it makes small sense to use value_string_fast with less than 16 or 32 (or even 64) entries.

Anyway I would keep linear search API and make dissector developer decide.

I thought about binary search when I tried to fix bug #594 [1]
with value_string array [2]. There're about 5k entries for tcp services.

[1] https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=594
[2] https://bugs.wireshark.org/bugzilla/attachment.cgi?id=4324