Skip to content

Enable Fast Floating-Point reading by default in 3.0 #1231

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

Closed
cowtowncoder opened this issue Mar 2, 2024 · 3 comments
Closed

Enable Fast Floating-Point reading by default in 3.0 #1231

cowtowncoder opened this issue Mar 2, 2024 · 3 comments
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Milestone

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Mar 2, 2024

For Jackson 2.x we have following features disabled by default:

  • StreamReadFeature.USE_FAST_DOUBLE_PARSER
  • StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER
  • StreamWriteFeature.USE_FAST_DOUBLE_WRITER

that is, for FP reading to use default JDK implementation and not one from FastDoubleParser (read) / Schubfach (write). This to minimize any chance of breakage, to require users to opt-in for optimized handling.

Since there hasn't been reports of issues during the time we've had (since 2.14, more than a year), it seems reasonable to assume things work well: so let's enable "fast FP" handling by default for 3.0.
We can still consider similar change for later 2.x, but let's start with 3.0.

EDIT: (2025-04-05)

Due to findings on lack of improvements for writing (equivalent or better code in JDK 21) for newer JDKs, default for StreamWriteFeature.USE_FAST_DOUBLE_WRITER will NOT be changed -- it remains disabled. Users on JDK 17 can then enable it.

@cowtowncoder cowtowncoder added the 3.x Issues to be only tackled for Jackson 3.x, not 2.x label Mar 2, 2024
@cowtowncoder cowtowncoder added this to the 3.0.0 milestone Mar 2, 2024
@j3graham
Copy link

j3graham commented Apr 5, 2025

One thought on this change - as of Java 19, an implementation of the Schubfach algorithm is used in the JDK itself, and there have been more improvements since then. Perhaps keeping the default USE_FAST_DOUBLE_WRITER using the JDK should be considered. See https://bugs.openjdk.org/browse/JDK-4511638

@pjfanning
Copy link
Member

@j3graham we did not change the write config for exactly the reason you describe.

You can see the v3 code here and its javadoc.

https://github.com/FasterXML/jackson-core/blob/master/src/main/java/tools/jackson/core/StreamWriteFeature.java#L115-L129

@cowtowncoder
Copy link
Member Author

I will update description, good call out @j3graham , @pjfanning.

@cowtowncoder cowtowncoder changed the title Enable Fast Floating-Point reading/writing by default in 3.0 Enable Fast Floating-Point reading (but writing) by default in 3.0 Apr 5, 2025
@cowtowncoder cowtowncoder changed the title Enable Fast Floating-Point reading (but writing) by default in 3.0 Enable Fast Floating-Point reading by default in 3.0 Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Projects
None yet
Development

No branches or pull requests

3 participants