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

Floating-point write performance on JDK 21: JDK now (slightly) faster than "Schubfab"-optimized path #1351

Closed
cowtowncoder opened this issue Oct 23, 2024 · 4 comments
Labels
2.19 Issues planned at earliest for 2.19 performance Issue related to performance problems or enhancements

Comments

@cowtowncoder
Copy link
Member

Something I found out when writing:

https://cowtowncoder.medium.com/jackson-2-18-fast-vector-reads-writes-6c2cf99c4594

is that while with JDKs 8 and 17 optimized floating-point writes (with StreamWriteFeature.USE_FAST_DOUBLE_WRITER) is about 2x as fast as JDK one, with JDK 21, JDK version is now slightly faster.

Code Jackson uses is from https://github.com/c4f7fcce9cb06515/Schubfach (as per notes on 3 classes in com.fasterxml.jackson.core.io.schubfach).

So it'd be good to consider what to do, if anything:

  1. Could there be newer version of "Schubfach" code implementation to use?
  2. Is there an explanation of why/how JDK 21 (and later presumably, could try) is so much faster than earlier versions (link would be nice to add)
  3. Should we document feature, suggesting it probably should not be enabled for JDKs 21 and above)
@cowtowncoder cowtowncoder added performance Issue related to performance problems or enhancements 2.19 Issues planned at earliest for 2.19 labels Oct 23, 2024
@cowtowncoder
Copy link
Member Author

cc @pjfanning

@pjfanning
Copy link
Member

The author of the Schubfach code seems to work on the JDK these days.
https://github.com/c4f7fcce9cb06515/Schubfach/blob/master/todec/src/math/DoubleToDecimal.java

Raffaello Giulietti

In the end of the day, it is good that the JDK has good performance. We can suggest that users only use StreamWriteFeature.USE_FAST_DOUBLE_WRITER=true if they are using an older JDK.

@cowtowncoder
Copy link
Member Author

Yes, absolutely good we need not override JDK handling. As long as we can be confident implementation has caught up which seems to be the case. Good learnings!

@cowtowncoder
Copy link
Member Author

Updated Javadocs to indicate improvements up to JDK 17, but not 21 or above; closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.19 Issues planned at earliest for 2.19 performance Issue related to performance problems or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants