-
-
Notifications
You must be signed in to change notification settings - Fork 799
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
Allow use of faster floating-point number parsing (Schubfach) with StreamReadFeature.USE_FAST_DOUBLE_PARSER
#577
Comments
I'd like to work on this issue, is it still available? |
@anneloreegger Yes, this is available! I'll assign it to you (no obligation to work, just a marker so others know you are considering it). |
Just to be sure I understand the issue correctly. Shall I especially improve the parsingMethods inside the NumberInput-class? (especially parseBigDecimal) |
@anneloreegger Yes, I think |
NOTE: |
double
/float
, BigInteger
, BigDecimal
)double
/float
, BigInteger
)
Unrelated to jsoniter but this recent port of Lemire's Double parser is 5.5X faster than the default double parser!! see also the original paper https://arxiv.org/abs/2101.11408 |
@LifeIsStrange thank you for sharing this! I hope someone might have time to maybe investigate possibility of PR for improvements here. |
double
/float
, BigInteger
)double
/float
, BigInteger
)
@cowtowncoder I'd like to work on this issue, could you assign it to me? |
I think @anneloreegger is not working on this, so will change assignee to @abc12345678912345. If anyone else wants to try to do it instead, please simple add a note here as courtesy; assignments are about intentions but with OSS things come and go. |
@cowtowncoder if FastDoubleParser was to be used in jacakson-core - would you accept it as dependency or would the code need to be inlined in jackson-core? jackson-core is still java6 bound - is this going to change? FastDoubleParser 0.2.0 is Java 8 and 0.3.0 is Java 11 bound. |
I would require inlining; using Maven shade plug-in might be acceptable. But not external dependency. As to Java 6... tough call. Was hoping to leave it for Jackson 2.x, but may reconsider. Java 6 support is iffy anyway; most likely we have Java 7. And not sure if much usage of latest versions by anyone is pre-Java 8 (although Android may have some odd limits). But Java 11 would be step too far for Jackson 2.x I think. Jackson 3.0, once I get back to doing it, may well choose different baseline -- Java 14? -- but right now it still only requires Java 8. |
com.fasterxml.jackson.core.io.ContentReferenece uses java.lang.Objects and that class only arrived in Java 7. My IDE won't compile jackson-core because of this. Only command line maven build seems to work. IntelliJ seems more concerned with enforcing these props - https://github.com/FasterXML/jackson-core/blob/2.14/pom.xml#L40 - than maven itself is |
Ok, that is a good example of accidental inclusion of Java 7 things that default tooling (compilation is already with JDK 8) cannot detect, and that we haven't added anything to guard. So I am not against proposing to raise Jackson 2.14 (for example) baseline officially to Java 8. |
one extra question - FastDoubleParser has a copyright and is generally MIT licensed - how would you handle this if the classes were copied to jackson-core - a special notice file? - could I keep the license headers in the source files too? |
@pjfanning Looks good. Just one question: are references to "ints" in this context still |
@cowtowncoder this issue is more about parsing and the FastDoubleParser can handle numbers with and without decimal points. When looking at serializing numbers, we can look whether the suggested alternatives like Schubfach output different values from Double.toString. Ultimately, I think any changes will be hidden behind config settings that are documented to warn users about potential diffs. |
Note that a similar but likely faster version has already been integrated into the JDK. See this PR for reference. A summary exists in this reddit post. |
@re-thc Also, Giulietti's "The Schubfach way to render doubles" was adopted for JDK 8 here and improved for JDK 11 here. Below are benchmark results for serialization of doubles by different JSON parsers for Scala using JDK 19. Before openjdk/jdk#3402
After openjdk/jdk#3402
|
Thank you for sharing @plokhotnyuk. Good to know JDK is improving as well. |
double
/float
, BigInteger
)
Ok. Thanks to @pjfanning we now have improved floating-point parsing functionality; merges are scattered (alas) through a few merges, purpose of which was to make it easier to merge to 3.0. |
StreamReadFeature.USE_FAST_DOUBLE_PARSER
Jsoniter project (https://github.com/plokhotnyuk/jsoniter-scala) has many impressive performance optimizations; linked f.ex from here:
https://www.reddit.com/r/java/comments/darehu/jackson_release_210/f1ysf1e/
Of ones included, number-parsing would be relevant for this repo.
EDIT: also see (from the comment below)
"Unrelated to jsoniter but this recent port of Lemire's Double parser:
https://github.com/wrandelshofer/FastDoubleParser
and the original paper https://arxiv.org/abs/2101.11408 also relevant"
The text was updated successfully, but these errors were encountered: