Skip to content
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

FastDoubleParser doesn't support all input formats as the default OpenJDK Float/Double parsers #778

Closed
grcevski opened this issue Jun 24, 2022 · 6 comments

Comments

@grcevski
Copy link

The FastDoubleParser recently introduced through this issue #577 is 3-4x times faster compared to the version that's implemented in OpenJDK. However the OpenJDK Double/Float parsers support variety of input formats that the FastDoubleParser will fail on, therefore it can cause unexpected regressions when used.

For example, the FastDoubleParser will fail with a NumberFormatException on these example patterns (there are many more to be found in the OpenJDK Double/Float tests):

1.1e-23f
0x.003p12f
0x1.17742db862a4P-1d

@grcevski
Copy link
Author

I made a PR with a proposed fix to use the default Java parses as a fallback when the exception occurs #779

@grcevski
Copy link
Author

I opened an issue with FastDoubleParser here wrandelshofer/FastDoubleParser#19

@cowtowncoder
Copy link
Member

@grcevski Those are not valid JSON floating-point numbers so shouldn't they fail? There are cases where databind is more liberal in what it accepts, although those cases are not well-defined.

@grcevski
Copy link
Author

Yeah it seems so, I didn't realize initially that the failures were explicitly related to the type suffix in particular. I don't think it will cause issues with JSON specifically (nor with XML), I'm not sure with other parsers implemented on top of jackson-core. The PR I opened has a bit more discussion on this.

@cowtowncoder
Copy link
Member

@grcevski Right, I think that ticket against FDP makes complete sense. Since Jackson backend decoders/parsers validate input anyway more lenient parsing by FDP should not be problematic either. Jackson JSON decoder does have some options for more lenient parsing too (allow optional leading plus sign, make leading 0 optional etc) so there may be some complications but overall I think things should be fine.

@grcevski
Copy link
Author

Closing this since it's only an issue with trailing 'f' and 'd' suffixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants