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

support jackson-core fast number parsing #835

Open
pjfanning opened this issue Dec 17, 2022 · 0 comments
Open

support jackson-core fast number parsing #835

pjfanning opened this issue Dec 17, 2022 · 0 comments

Comments

@pjfanning
Copy link
Contributor

pjfanning commented Dec 17, 2022

Jackson 2.14's JsonFactory supports these features.

  • StreamReadFeature.USE_FAST_DOUBLE_PARSER
  • StreamWriteFeature.USE_FAST_DOUBLE_WRITER

play-json's BigDecimalParser may also benefit from using jackson-core's BigDecimalParser - you should keep the number length check that play-json has but the parsing of the string can benefit from jackson-core's BigDecimalParser which has special code to speed up parsing of very long numbers.

Just thought I'd raise awareness of these features of jackson-core. With the StreamReadFeature and StreamWriteFeature, you would probably want to make those opt-in - that play-json should probably not use them by default.

Jackson 2.15.0-rc1 is out today (Mar 18, 2023). It has an additional feature - StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER

You can make the limits effectively unlimited by creating a JsonFactory that overrides the default StreamReadConstraints.
An example that increases the max number len:

   val jsonFactory = JsonFactory.builder()
     .streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(Integer.MAX_INTEGER).build())
     .build()

If you do plan to upgrade to use Jackson 2.15, you will need to consider how to integrate Jackson's StreamReadConstraints (particularly the number len check) with play-json's pre-existing support for checking the len of BigDecimal/BigInteger.

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

1 participant