-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Improve perf of float and double parsing in TextBuffer #1230
Improve perf of float and double parsing in TextBuffer #1230
Conversation
@pjfanning Yes, this is what I had in mind. I'll have a look and suggest some changes. Since we are not (yet) changing calling from I also think that we can remove some of deferral because calls to, say, |
src/main/java/com/fasterxml/jackson/core/util/ReadConstrainedTextBuffer.java
Outdated
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/core/util/TestTextBuffer.java
Outdated
Show resolved
Hide resolved
7bc8b89
to
64e25b2
Compare
…jackson-core into textbuffer-double-float-parse
I think I'll go ahead and merge this: it will be needed to tackle #1229. |
if (_inputStart >= 0) { // shared? | ||
return NumberInput.parseDouble(_inputBuffer, _inputStart, _inputLen, useFastParser); | ||
} | ||
if (_currentSize == 0) { // all content in current segment! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug, actually -- should use _hasSegments
instead! Fixed in #1313.
if (_inputStart >= 0) { // shared? | ||
return NumberInput.parseFloat(_inputBuffer, _inputStart, _inputLen, useFastParser); | ||
} | ||
if (_currentSize == 0) { // all content in current segment! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, fixed in #1313
@cowtowncoder is this a long the right lines? If so, I can add tests. If we get this done for floats and doubles, we can come back to make similar changes for other number types.
I'm aware that this does not address the deferred number parsing in ParserBase (where numbers can be stored as
_numberString
until we know what type we need). Storing the number as the wrong number type and later converting it to a different number type can lead to number conversion issues and can be more expensive.