RFR: 8315585: Optimization for decimal to string [v6]
Shaojin Wen
duke at openjdk.org
Mon Oct 16 11:55:50 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
The performance of using StringConcatFactory.makeConcatWithConstants is sometimes fast and sometimes slow:
# Run progress: 0.00% complete, ETA 00:00:30
# Fork: 1 of 3
# Warmup Iteration 1: 19.816 ns/op
# Warmup Iteration 2: 17.289 ns/op
# Warmup Iteration 3: 17.653 ns/op
# Warmup Iteration 4: 17.703 ns/op
# Warmup Iteration 5: 17.698 ns/op
Iteration 1: 17.655 ns/op
Iteration 2: 17.564 ns/op
Iteration 3: 17.628 ns/op
Iteration 4: 17.760 ns/op
Iteration 5: 17.679 ns/op
# Run progress: 33.33% complete, ETA 00:00:20
# Fork: 2 of 3
# Warmup Iteration 1: 13.430 ns/op
# Warmup Iteration 2: 12.064 ns/op
# Warmup Iteration 3: 12.366 ns/op
# Warmup Iteration 4: 12.384 ns/op
# Warmup Iteration 5: 12.380 ns/op
Iteration 1: 12.370 ns/op
Iteration 2: 12.346 ns/op
Iteration 3: 12.395 ns/op
Iteration 4: 12.377 ns/op
Iteration 5: 12.351 ns/op
# Run progress: 66.67% complete, ETA 00:00:10
# Fork: 3 of 3
# Warmup Iteration 1: 19.125 ns/op
# Warmup Iteration 2: 17.398 ns/op
# Warmup Iteration 3: 17.801 ns/op
# Warmup Iteration 4: 17.702 ns/op
# Warmup Iteration 5: 17.766 ns/op
Iteration 1: 17.748 ns/op
Iteration 2: 17.804 ns/op
Iteration 3: 17.681 ns/op
Iteration 4: 17.673 ns/op
Iteration 5: 17.624 ns/op
It was run on a MacBook M1 Max. There were three iterations. The first time was slow, the second time was fast, and the third time was slow again.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1764305769
More information about the core-libs-dev
mailing list