RFR: 8315585: Optimization for decimal to string

温绍锦 duke at openjdk.org
Wed Oct 4 23:11:28 UTC 2023


On Mon, 2 Oct 2023 05:40:03 GMT, 温绍锦 <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, Here are the numbers run on a MacBook M1 Pro:
> 
> 
> -Benchmark                                 Mode  Cnt     Score    Error  Units (baseline)
> -BigDecimals.testHugeToEngineeringString   avgt   15   228.102 ? 12.568  ns/op
> -BigDecimals.testLargeToEngineeringString  avgt   15    53.814 ?  0.180  ns/op
> -BigDecimals.testSmallToEngineeringString  avgt   15    17.521 ?  0.521  ns/op
> -BigDecimals.testToEngineeringString       avgt   15  1814.858 ? 64.432  ns/op
> 
> +Benchmark                                 Mode  Cnt     Score    Error  Units ()
> +BigDecimals.testHugeToEngineeringString   avgt   15   209.579 ?  5.037  ns/op (+8.84)
> +BigDecimals.testLargeToEngineeringString  avgt   15    29.617 ?  0.557  ns/op (+81.70)
> +BigDecimals.testSmallToEngineeringString  avgt   15    11.230 ?  0.075  ns/op (+56.02)
> +BigDecimals.testToEngineeringString       avgt   15  1732.913 ? 33.629  ns/op (+4.73)
> 
> 
> Please review and don't hesitate to critique my approach and patch.

@jddarcy, could you please review my code? Thank you!

@cl4es could you please review my code? Thank you!

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

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


More information about the core-libs-dev mailing list