UTF8JsonGenerator: writeNumber fast path that avoids extra String allocation - #1657
Conversation
|
@cowtowncoder this change gives quite a boost when using Utf8JsonGenerator with USE_FAST_DOUBLE_WRITER enabled. I'll put the numbers in https://github.com/pjfanning/double-reader-writer readme. Where baselineWriteDoubleArray is existing jackson-core, pr1657WriteDoubleArray is with this change and xjbWriteDoubleArray is with this change plus the XJB Writer from #1656. |
|
@cowtowncoder I think this change is small enough that it might be worth considering including it in the next 3.2 release or even the nest 3.1 LTS release. There is an argument that the related PR1656 is too big to add until 3.3.0. |
|
@pjfanning If you can rebase against 3.2, sure -- I am now releasing 3.1.6 so maybe not 3.1. |
|
Needs EDIT: added. |
26fd7a6 to
6593e64
Compare
6593e64 to
2fb2911
Compare
|
Retargeted PR to 3.2 branch |
Partially related to #1656
The new XJBWriter has support for writing the number to a pre-existing byte array and avoid String allocations.
It's possible that 1656 will get nowhere but I thought that it might be worth considering this change as a completely separate change.
I modified the existing Schubfach code to allow String allocation to be skipped when writing numbers in UTF8JsonGenerator.
And if we do switch to XJB, the NumberOutput class can be modified to use XJB instead of Schubfach but this PR tests UTF8JsonGenerator in isolation.
This change only kicks in if you enable StreamWriteFeature.USE_FAST_DOUBLE_WRITER