On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen <[email protected]> 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
public class BigDecimals {
public void setup() {
for (int i = 0; i < TEST_SIZE; i++) {
smallArray[i] = new BigDecimal("" + ((long) value / 1000) + ".5" +
(i % 10));
}
}
}
I changed it, but it's still sometimes fast and sometimes slow. But using
StringConcatHelper.prepend is faster every time
* StringConcatFactory.makeConcatWithConstants branch :
https://github.com/wenshao/jdk/tree/optim_decimal_to_string_x1_mcwc
* StringConcatHelper.prepend branch :
https://github.com/wenshao/jdk/tree/optim_decimal_to_string_x1_test
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1764422223