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

温绍锦 duke at openjdk.org
Mon Oct 9 19:20:29 UTC 2023


> 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.

温绍锦 has updated the pull request incrementally with one additional commit since the last revision:

  refactor based on @liach 's review

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16006/files
  - new: https://git.openjdk.org/jdk/pull/16006/files/a8ec3c57..05406d99

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16006&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16006&range=00-01

  Stats: 220 lines in 6 files changed: 47 ins; 139 del; 34 mod
  Patch: https://git.openjdk.org/jdk/pull/16006.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16006/head:pull/16006

PR: https://git.openjdk.org/jdk/pull/16006


More information about the core-libs-dev mailing list