I;ve just noticed that the diff I posted is form my test-bed, not the actual
final version. the code should be:

   if (needle_len == 1){
        return (char *)memchr(p, *needle, (end-p));
    }

instead of

+       if (needle_len == 1){
+               return (char *)memchr(p, *needle, (end-p+1)); <- this fails
for strpos("", NULL);
+       }
+


Christopher Jones wrote:
* Hi Michal,
*
*This is always a fun topic.
*
*I think your stripos tests should show the no-match performance case.
*
*Chris

I haven't said the  implementation with lowering chars at the compare time
is better: I've just shown some comparison results. Of course it is slower
in no-match case - it is even slower when the match is closer to end of the
string (it is why I posted 2 different results for the same string length -
one for match in the middle, and one close to the end - which is actually
similar to no-match). I just said it MIGHT be worth considering. I will
analyse my logs to find out what is the average match position, to check if
it is really worth implementing.

Reply via email to