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

Shaojin Wen swen at openjdk.org
Tue Feb 4 23:25:16 UTC 2025


On Sat, 1 Feb 2025 08:42:32 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString and BigDecimal::toPlainString performance and reduce duplicate code
>
> Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 29 commits:
> 
>  - Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
>    
>    # Conflicts:
>    #	src/java.base/share/classes/jdk/internal/util/DecimalDigits.java
>  - remove getChars(long, int, char[])
>  - copyright
>  - Merge remote-tracking branch 'upstream/master' into dec_to_str_202501
>    
>    # Conflicts:
>    #	src/java.base/share/classes/jdk/internal/util/DecimalDigits.java
>  - simplify and comments
>  - simplify
>  - simplify
>  - code style
>  - revert change
>  - bug fix
>  - ... and 19 more: https://git.openjdk.org/jdk/compare/651ac3cc...f9af0b02

I think you are talking about the problem of PR #23420, which is caused by the use of thread-unsafe StringBuilder in multi-threaded scenarios. This problem is very obscure and I didn't consider it before. I have started to solve this problem and have submitted PR #23427. After it is completed, I will continue to submit PR to redo PR #19626 in a thread-safe way.

The above problem does not affect toString, because it only occurs when StringBuilder is used in a multi-threaded scenario.

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

PR Comment: https://git.openjdk.org/jdk/pull/23310#issuecomment-2635284370


More information about the core-libs-dev mailing list