This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve strstr performance


Adhemerval wrote:
> I am checking if it is worth to keep the implementation in sync with gnulib,
> since it contains some changes over the years which did not make into glibc.
>
> I create a branch with these changes [1] along with your changes, but
> results are mixed:

Well that's no surprise - the synced code looks much cleaner but will be slower
without my patch. As is it removes the search for the next matching character,
so it uses AVAILBLE every character which means even more calls to memchr...
Your version of my patch removes the FASTSEARCH optimization (maybe missing
str-two-way.h?), so it loses the main performance gain.

Overall the synced version makes the code far more readable, so it is a good idea
as a basis for further improvements. However it will only be faster with my patch
fully merged.

This looks dubious and will slow down strcasestr:

-#define TOLOWER(Ch) tolower (Ch)
+#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))

Wilco


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]