This is the mail archive of the
mailing list for the glibc project.
Re: Thoughts on bug 15884
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Rich Felker <dalias at libc dot org>
- Cc: Leonhard Holz <leonhard dot holz at web dot de>, libc-alpha at sourceware dot org
- Date: Tue, 16 Sep 2014 12:11:13 -0700
- Subject: Re: Thoughts on bug 15884
- Authentication-results: sourceware.org; auth=none
- References: <5416A626 dot 3050501 at web dot de> <54171E87 dot 8050604 at redhat dot com> <541723E1 dot 3040705 at cs dot ucla dot edu> <20140916162047 dot GY23797 at brightrain dot aerifal dot cx>
On 09/16/2014 09:20 AM, Rich Felker wrote:
I don't know what strxfrm is good for in practice.
Obviously the case where it matters is where each of your strings is
in the form of a common large prefix and a tiny difference at the end.
Here strcoll will perform pathologically bad (at least without some
kind of memoization) and strxfrm solves the problem.
I know the *theory*. But I don't see how strxfrm is a win in *practice*.
Long ago I asked someone on the C committee why it was in the standard,
and he answered that it seemed like a good idea back in the 1980s, and
that it'd be too painful to remove from the C standard now. He (and I)
couldn't provide any examples of it being used in practical software.
glibc dutifully implements strxfrm; but not efficiently, which is fine.
Why bother to improve the performance of a function that's practically
strcoll, on the other hand, is a big deal. Making it go faster would be
a real win.