lkml.org 
[lkml]   [2023]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 1/1] lib/string: Use strchr() in strpbrk()
On Sat, Jan 28, 2023 at 4:51 PM David Laight <David.Laight@aculab.com> wrote:
>
> From: Andy Shevchenko
> > Sent: 27 January 2023 15:52
> >
> > Use strchr() instead of open coding it as it's done elsewhere in
> > the same file. Either we will have similar to what it was or possibly
> > better performance in case architecture implements its own strchr().
>
> Except that you get a whole load of calls to strchr() for (typically)
> very few characters.
> So the cost of the calls dominates, anything that tries to speed up
> strchr() for long strings will also slow things down.

Hmm... I haven't seen the calls, I assume gcc simply inlined a copy of that.

...

> Although I very much doubt strpbrk() is used anywhere where
> performance matters.

strsep()/strspn() are the users.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2023-03-27 00:00    [W:0.197 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site