-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codesize of strtod/strtof/strtold is unreasonable large #51
Comments
Good question. Wasn't that because glibc is (was) supposed to work on CPUs with non-standards FP types? |
That's possible, but we have already lots of other m68k/TOS dependencies in mintlib, so we don't have to worry about supporting little-endian formats or whatever. 30k is imho unacceptable for a single function. And that only accounts for strtod, i guess the other way (used in the printf functions) isn't much better. |
I absolutely agree, I just meant that it was imported with such code and let as it was. I don't object against removing it, not at all. |
Its even worse than i thought. The definition in Line 221 in 5919d04
I've looked also at other implementations, e.g from musl. They use only a single function for all three flavours, but that also compiles to ~10k of code. Additionally, it uses scalb() and some other functions from libm. That is something we definitely want to avoid (not only because of the codesize, but until now great care has been taken that mintlib does not have any references to libm) So still looking for better implementations. |
See #69. Could you have a look? (ignore the commit for the makefiles, that wasn't meant to be placed in that branch) |
The code produced by those functions is about 9k each (a bit less for the -m68881 version). All three are referenced eg. by the scanf family of functions. Together with some floating support functions from libgcc.a, that alone adds about 30k of code to executables.
I think the current implementation (in strtod.c) is almost identical to the original one from glibc. I also think that most of the code is produced by the inlined mpn_* functions from gmp. So the question is: can that be reimplemented without gmp? I never understood why we need functions that can work on arbitrary long doubles, when we only have to work with a max. of 3 different, known sizes.
The text was updated successfully, but these errors were encountered: