Re: strcspn(3) complexity improvement

From: Jon Noack <noackjr_at_alumni.rice.edu>
Date: Tue, 05 Apr 2005 23:33:30 -0500
On 04/05/05 22:46, Matthew Dillon wrote:
> :The real question I have is, how long does the string need to be before
> :this is a win and how much does it hurt for typical string lengths?
> :I've written code with strcspn that needed to perform well, but it was
> :parsing 80-column punch card derived formats.
> :
> :-- Brooks
> 
>      I think the answer is to not use strcspn() in cases where it *really*
>      matters.
> 
>      I don't think what's in DFly is the right solution either.  A bitmap
>      would be a good compromise, though... that would only require clearing
>      32 bytes (vs 256) at the cost of slowing down the loop a little.

The version das_at_ committed used one bit per element:
http://lists.freebsd.org/pipermail/cvs-src/2005-April/044040.html

Jon
Received on Wed Apr 06 2005 - 02:33:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:31 UTC