lkml.org 
[lkml]   [2015]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] un-improve strrchr()
From
On Wed, Jul 1, 2015 at 2:52 AM, Chris Rorvick <chris@rorvick.com> wrote:
> [ resending w/o HTML formatting ]
>
> On Sun, Jun 28, 2015 at 11:44 AM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
>> Previous code did 1 branch per character + 1 branch for every character
>> in the last path component. Current code does 2 branches per characher
>> regardless.
>
> Shouldn't that be "+ 2 branches for every character in the last path
> component"? The structure of the loop is basically the same; you're
> just performing fewer iterations if the character is found when
> searching from the end.

Yes, changelog is inaccurate.

It is "1 branch per character + 2 branches per character in
the last path component" vs "2 branches per character".

Rasmus posted benchmark (obvious rdtsc/strrchr/rdtsc) in private.

Speed highly depends on -O2/-Os setting and current mainline code
is not uniformly faster at least for me. I'll probably resend with new
and improved changelog.


\
 
 \ /
  Last update: 2015-07-01 16:21    [W:0.098 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site