strcspn(3) complexity improvement

From: Jeremie Le Hen <jeremie_at_le-hen.org>
Date: Wed, 30 Mar 2005 10:34:35 +0200
Hi list,

Andreas Hauser made a patch to strcspn(3) for the DragonFly project
which makes it faster when dealing with long strings [1] (rev 1.4).
It basically changes the complexity of the function from
    O(strlen(str) * strlen(chars))
to
    O(strlen(str) + strlen(chars))
by using a charset.

I have two questions.  First, is this change worth enough to be merged
in FreeBSD (this function is currently used in 42 binaries from
/{,usr/}{s,}bin) ?  I mean does the performance gain on large strings
compensates the use of a large 256-bytes buffer ?

Second, I would like to know how to deal with the copyright update.
ATM, I changed the top of the copyright (up to Andrea's email address),
is it acceptable ?

The temporary patch is here [2], I didn't have time to try it yet, this
is why it is not attached with this email.

Best regards,

[1] http://www.dragonflybsd.org/cvsweb/src/lib/libc/string/strcspn.c
[2] http://jeremie.le-hen.org/~tataz/patches/FreeBSD/libc.strcspn.dfbsd.patch
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >
Received on Wed Mar 30 2005 - 06:35:04 UTC

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