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

Shaojin Wen duke at openjdk.org
Tue Oct 17 15:34:52 UTC 2023


On Mon, 16 Oct 2023 15:00:42 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 StringConcatFactory.makeConcatWithConstants

After using recipe ("\1.\1\1") and modifying String.getBytes, there will still be occasional slowdowns. I haven't found the reason yet.


# Run progress: 0.00% complete, ETA 00:00:30
# Fork: 1 of 3
# Warmup Iteration   1: 23.557 ns/op
# Warmup Iteration   2: 20.149 ns/op
# Warmup Iteration   3: 21.658 ns/op
# Warmup Iteration   4: 21.239 ns/op
# Warmup Iteration   5: 20.374 ns/op
Iteration   1: 20.120 ns/op
Iteration   2: 19.952 ns/op
Iteration   3: 20.381 ns/op
Iteration   4: 20.531 ns/op
Iteration   5: 20.468 ns/op

# Run progress: 33.33% complete, ETA 00:00:23
# Fork: 2 of 3
# Warmup Iteration   1: 13.481 ns/op
# Warmup Iteration   2: 11.702 ns/op
# Warmup Iteration   3: 11.963 ns/op
# Warmup Iteration   4: 11.982 ns/op
# Warmup Iteration   5: 11.965 ns/op
Iteration   1: 11.946 ns/op
Iteration   2: 11.961 ns/op
Iteration   3: 11.988 ns/op
Iteration   4: 11.980 ns/op
Iteration   5: 11.969 ns/op

# Run progress: 66.67% complete, ETA 00:00:10
# Fork: 3 of 3
# Warmup Iteration   1: 13.148 ns/op
# Warmup Iteration   2: 11.542 ns/op
# Warmup Iteration   3: 11.991 ns/op
# Warmup Iteration   4: 12.015 ns/op
# Warmup Iteration   5: 12.012 ns/op
Iteration   1: 11.977 ns/op
Iteration   2: 11.988 ns/op
Iteration   3: 12.006 ns/op
Iteration   4: 11.988 ns/op
Iteration   5: 11.986 ns/op

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

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


More information about the core-libs-dev mailing list