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]

[RFC] Improve strcasestr with strpbrk


Hi, I plan to also optimize strcasestr with similar heuristic as strstr
improvement that I just sent.
It needs some precomputing so I ask which path to take.

A simplest one would just check if tolower of characters in 0-128 range maps as C locale. Then I would add specialized assembly for strpbrk like

strasciibrk(s, n0, n1) - finds first byte that is either n0, n1 or
outside 0-128 byte range.

Second possibility would be calculate equivalence classes. Then we could
just replace strchr (s, n[0]) with strpbrk (s, equivalence_class (n[0]))

Problem is that calculating equivalence classes is expensive for
multibyte UTF so table would need to be saved to disk.

So which alternative should be used?


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