This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Faster string to integer conversion
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Faissal Bensefia <faissaloo at me dot com>, libc-alpha at sourceware dot org
- Date: Sun, 10 Apr 2016 12:54:30 -0700
- Subject: Re: Faster string to integer conversion
- Authentication-results: sourceware.org; auth=none
- References: <570A225E dot 20409 at me dot com>
Thanks for thinking about this. Certainly strtol etc. could be sped up and the
approach you mention might be a win; it's hard to say, given its setup overhead.
In practice most integers are small, and you'd need to benchmark the approach on
a set of integers that are of "typical" size. It may well be more work to come
up with a convincing benchmark than to come up with the actual code.
If you're interested in strtol speedup ideas, how about this one? Jettison
tables like __strtol_ul_max_tab and replace their uses with invocations of the
INT_ADD_WRAPV macro defined by the following recently-proposed patch:
https://sourceware.org/ml/libc-alpha/2016-04/msg00174.html