RFR: 8315585: Optimization for decimal to string [v4]
Claes Redestad
redestad at openjdk.org
Thu Oct 12 19:48:19 UTC 2023
On Wed, 11 Oct 2023 21:46:04 GMT, Shaojin Wen <duke at openjdk.org> wrote:
>> I submitted PR #15555 before, and there were too many changes. I split it into multiple PRs with small changes. This one is one of them.
>>
>> this PR removed the duplicate code for getChars in BigDecimal#StringBuilderHelper, i also make performance faster.
>> Please review and don't hesitate to critique my approach and patch.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> fix from @cl4es 's review
Yes, explicitly calling into `StringConcatFactory` and invoking MHs is cumbersome. Just putting it out there as an alternative that works based on current public API.
It might also be possible to evolve the decision to compile all of java.base with `-XDstringConcat=inline` to instead only do that for a subset of the most core classes. We could then just do `return "" + highInt + '.' + (char)(pair & 0xff) + (char)(pair >> 8);` and get the same performance.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1760268835
More information about the core-libs-dev
mailing list