Wireshark-dev: Re: [Wireshark-dev] Profiling results with optimized function ws_mempbrk_sse42()
From: Jakub Zawadzki <[email protected]>
Date: Wed, 4 Jun 2014 23:30:09 +0200
Hi,

On Wed, Jun 04, 2014 at 11:24:59AM +0000, Anders Broman wrote:
> I did a test with
> static inline const guint8*
> guint8_pbrk(const guint8* haystack, size_t haystacklen _U_, const guint8 *needles, guchar *found_needle)
> {
>                 const guint8 *result = (const guint8 *)strpbrk(haystack, needles);
> 
>                 if (result && found_needle)
>                                 *found_needle = *result;
> 
>                 return result;
> }
> 
> Which seems to give as good results on Ubuntu 13.10, it ends up using __strpbrk_sse42 (libc-2.17.so: strcspn-c.c, ...)
> ==29458==
> ==29458== Events    : Ir
> ==29458== Collected : 21130728727
> ==29458==
> ==29458== I   refs:      21,130,728,727
> Load time in WS 0:19.300

Yep, ws_mempbrk_sse42() is based on __strpbrk_sse42(), and it should give similar results.
Still we must have binary (string, length) search, and strpbrk() works correctly only for NUL terminated string.
Our tvb's are not NUL terminated, and strpbrk() won't skip over NULs, so we need some modification.

Cheers,
Jakub.