RFR: 8315585: Optimization for decimal to string [v6]

Shaojin Wen duke at openjdk.org
Mon Oct 16 15:23:47 UTC 2023


On Fri, 13 Oct 2023 17:01:11 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:
> 
>   use % calculate lowInt

I have found the reason. Using the following recipe is faster every time:

MethodType.methodType(String.class, long.class, char.class, char.class, char.class),
                            "\1\1\1\1"


* Using the following recipe is sometimes faster and sometimes slower, because there is a prepare(long indexCoder, byte[] buf, String value) operation here

MethodType.methodType(String.class, long.class, char.class, char.class),
                            "\1.\1\1"

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1764634547


More information about the core-libs-dev mailing list