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
add configs to enable fastdoubleparser #747
Conversation
@cowtowncoder I added 40d9944 to try to start an implementation where the user gets to choose whether to use the JDK double parser (default) or the fast double parser. This starting point highlights just how much code will ultimately need to change to allow this to be a controllable feature. Do you have any thoughts on whether we should proceed or if this change is worthwhile at all? It feels like it would be tidier to change NumberInput to be an object instance with configuration and instead of having is a stateless singleton with static methods. |
Ok, some notes/comments: I think that attempts to make Although, we could consider adding something as alternative to That sounds like the way I'd go about this, I think. We would probably then start actually deprecating methods in |
@cowtowncoder - I'll keep NumberInput as is and have modified the 'double' parsing methods to take a boolean and deprecated the original versions of these methods - which default to not using the fast-double-parser |
@cowtowncoder currently, this code relies on a new JsonParser.Feature.USE_FAST_DOUBLE_PARSER - if you are creating a JsonMapper, how do you set JSON parser features? I have FasterXML/jackson-databind#3475 which shows what a partial uptake in jackson-databind looks like. NumberDeserializers has some methods that use JsonParser but there are also some methods on NumberDeserializers that are only passed a DeserializationContext. Would I need a jackson-databind DeserializationFeature as well (for enabling USE_FAST_DOUBLE_PARSER)? |
@pjfanning No, it should be possible to both:
Oh.... but we do have one challenge;
So the preferred path is via The other question is whether this should be dynamic feature or not; in many cases I'd probably suggest not. So I guess starting with combo of |
@cowtowncoder I just added JsonReadFeature USE_FAST_DOUBLE_PARSER - would you be able to suggest the best way to test that? |
I think it'd be great to be able to run tests across multiple backends (InputStream, Reader, InputData-backed, async). But this would add a new value in matrix (for default vs fast parsing). It might make sense to add a new tests and first just have a relatively simple tests for float values in Arrays, Objects but iterating over all configurations? |
@cowtowncoder I added some more 'read' tests. Would you be able to review this PR when you have time? |
@cowtowncoder is this PR under consideration for the v2.14 release or should I target it at another branch? |
@pjfanning Apologies for being very slow to follow up again. Yes, I think these can and should be considered still for 2.14. I will try to merge the one must-fix I have, the only thing I know has to go in (databind #3473), which I just completed. |
Hi @pjfanning! Ok, I had a chance to get back to this. I think it makes sense, but now I am bit worried about merging this to
I could then merge this to Would this be possible? I will make sure to get smaller PR merged ASAP whenever it gets here. |
@cowtowncoder I have split out #766. That Pr should readily merge to 2.14 and master. It is the biggest part of this PR. After that is merged, I can break this PR up further into smaller PRs that won't merge as easily but by keeping them small, the merge conflicts should be manageable. |
add one doubleparser test case (as a start) uptake latest code update float parse don't parse floats as doubles first add feature to control double parser impl refactor params remove some deprecations (will be hard to change all calls in jackson-databind to use new methods) add fast-double-parser tests add fast float support Update NumberInput.java update tests Create ReaderTest.java remove char array support add JsonReadFeature.USE_FAST_DOUBLE_PARSER Update FloatParsingTest.java float support Update TextBuffer.java add tests Delete AbstractFloatValueFromCharArray.java latest code from fastdoubleparser update tests latest Werner Randelshofer code update licenses Update package-info.java Update package-info.java
@cowtowncoder I rebased this PR and it is fairly small now. Could you merge this and you can use #765 as a guide when you hit a few merge issues when you forward merge this PR to master? You won't need to merge #765 itself - it just shows the changes I had to make when I went through a similar exercise trying to fix the merge conflicts. |
@pjfanning Ok I hope to get this done tonight, or if not, over the weekend. |
@pjfanning I'll merge this now but after thinking about this I think that this makes sense as |
Ok, done: changed feature to be |
#577