strcspn(3) complexity improvement
Jeremie Le Hen
jeremie at le-hen.org
Wed Mar 30 00:35:04 PST 2005
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 >
More information about the freebsd-current
mailing list