This is the mail archive of the
mailing list for the glibc project.
Re: [RFC][BZ #16009] Memory handling in strxfrm_l()
- From: Leonhard Holz <leonhard dot holz at web dot de>
- To: libc-alpha at sourceware dot org
- Date: Tue, 25 Nov 2014 21:20:04 +0100
- Subject: Re: [RFC][BZ #16009] Memory handling in strxfrm_l()
- Authentication-results: sourceware.org; auth=none
- References: <546DCC25 dot 4020808 at web dot de> <20141121040317 dot GT22465 at brightrain dot aerifal dot cx> <546F12A3 dot 5030204 at web dot de> <20141122233907 dot GA2516 at domone> <5472F9AF dot 3060005 at web dot de> <54737BB3 dot 9060102 at cs dot ucla dot edu>
Am 24.11.2014 19:40, schrieb Paul Eggert:
On 11/24/2014 01:26 AM, Leonhard Holz wrote:
strxfrm is a function for pre-computing things that need to be fast
That may be true in theory, but in practice strxfrm is pretty much
useless everywhere. When I tried to use it in GNU sort, I gave up in
frustration, as strxfrm was soooo sllooooow that it was much better to
simply use strcoll and be smart about it. I don't know of any practical
application that uses glibc strxfrm in a real way, and my advice for
optimizating strxfrm is to not bother, and to focus one's efforts on
making strcoll go faster.
Unless perhaps you're thinking of rewriting strxfrm from scratch, in
which case we can talk about what's needed.
Indeed it's not that easy to imagine a use case for strxfrm as storing
the result of comparison (e.g. as an ordered database index) is probably
always better than doubling or tripling the needed space just to make
comparison faster. Particularly if you consider that different strings
are likely to differ after a few bytes independent of there overall length.
Anyhow the security issue in strxfrm has to be fixed. ;)