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



On 29/06/2018 20:23, Wilco Dijkstra wrote:
> 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.

My intention was to check if it would be worth to sync gnulib and then
apply your change on top or the other way around.  It seems it would be
better to add your patch and I will propose another with some gnulib
changes (mainly documentation and small optimizations).  Some glibc
differences seems more to get around some compiler missed optimization
than actually code improvements (99677e575504 for instance).

> 
> This looks dubious and will slow down strcasestr:
> 
> -#define TOLOWER(Ch) tolower (Ch)
> +#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
> 
> Wilco
> 

This was corrected on glibc side and did not get back into gnulib.


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