FasterXML / jackson-core

Core part of Jackson that defines Streaming API as well as basic shared abstractions
Apache License 2.0
2.25k stars 777 forks source link

Improve perf of float and double parsing in TextBuffer #1230

Closed pjfanning closed 5 months ago

pjfanning commented 6 months ago

@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.

cowtowncoder commented 6 months ago

@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 ParserBase, I think this could actually go in 2.17, even.

I also think that we can remove some of deferral because calls to, say, getFloatValue() does explicitly establish target type -- but this is easy enough to verify with more time wrt 2.18 once 2.17 is out. But that question is separate from work to make TextBuffer pass more optimal representation.

cowtowncoder commented 5 months ago

I think I'll go ahead and merge this: it will be needed to tackle #1229.