Re: RFR: 8315585: Optimization for decimal to string [v5]

2025-04-22 Thread Shaojin Wen
> 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 30 commits: - Merge rem

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

2025-03-09 Thread Shaojin Wen
On Sat, 1 Feb 2025 08:42:32 GMT, Shaojin Wen 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 re

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

2025-02-07 Thread Paul Sandoz
I would like to amplify this point — undermining Java’s integrity is a big deal. Every time we use unsafe mechanisms within the JDK we risk doing that. The more complex such code is the harder it is reason about whether overall it is safe [*]. We need to balance reasoning about code, quality, an

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

2025-02-07 Thread Archie Cobbs
On Tue, Feb 4, 2025 at 5:26 PM Shaojin Wen wrote: > 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 probl

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

2025-02-04 Thread Shaojin Wen
On Sat, 1 Feb 2025 08:42:32 GMT, Shaojin Wen 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 re

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

2025-02-04 Thread Archie Cobbs
On Tue, Feb 4, 2025 at 2:40 PM Joe Darcy wrote: > Can we please have a pause on the sequence of "make XYZ toString faster" > PRs until there is some wider discussion of goals, etc.? Thanks. > I agree with this sentiment... It was surprising to see how easily a VM crash can sneak in. There is al

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

2025-02-04 Thread Joe Darcy
On Sat, 1 Feb 2025 08:42:32 GMT, Shaojin Wen 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 re

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

2025-02-02 Thread Shaojin Wen
On Sun, 2 Feb 2025 06:58:21 GMT, Johannes Graham wrote: >> Good suggestion, but DecimalDigits no longer provides a pair method > > Right - you’d need to add it back to try this I tested it on a MacBook M1 Max machine and the results were different from what you said. Using StringBuilder + digit

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

2025-02-01 Thread Shaojin Wen
On Sat, 1 Feb 2025 21:04:29 GMT, Johannes Graham wrote: >> 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 >> >># Confl

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

2025-02-01 Thread Johannes Graham
On Sat, 1 Feb 2025 08:42:32 GMT, Shaojin Wen 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 re

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

2025-02-01 Thread Shaojin Wen
> 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 rem

Re: RFR: 8315585: Optimization for decimal to string [v3]

2025-01-30 Thread Shaojin Wen
> 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 incrementally with one additional commit since the last revision: remove getChars(long, int, char[]) -

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

2025-01-29 Thread Shaojin Wen
> 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 27 commits: - copyright

Re: RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Johannes Graham
On Mon, 27 Jan 2025 06:03:17 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/math/BigDecimal.java line 3538: >> >>> 3536: return (signum < 0 ? "-0." : "0.").concat(intString); >>> 3537: } else if (insertionPoint > 0) { /* Point goes inside intVal >>> */ >>> 3538:

Re: RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Shaojin Wen
On Sun, 26 Jan 2025 19:31:08 GMT, Johannes Graham wrote: >> Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString >> and BigDecimal::toPlainString performance and reduce duplicate code > > src/java.base/share/classes/java/math/BigDecimal.java line 3538: > >> 3536:

Re: RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Johannes Graham
On Sat, 25 Jan 2025 07:25:40 GMT, Shaojin Wen wrote: > Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString > and BigDecimal::toPlainString performance and reduce duplicate code src/java.base/share/classes/java/math/BigDecimal.java line 3538: > 3536: return

Re: RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Shaojin Wen
On Sat, 25 Jan 2025 07:25:40 GMT, Shaojin Wen wrote: > Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString > and BigDecimal::toPlainString performance and reduce duplicate code The performance numbers as follows. In the smallScale2EngineeringToString and smallScale2Lay

Re: RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Chen Liang
On Sat, 25 Jan 2025 07:25:40 GMT, Shaojin Wen wrote: > Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString > and BigDecimal::toPlainString performance and reduce duplicate code A great cleanup that consolidates scale2, unscaledAbsString, and unscaledString. ---

RFR: 8315585: Optimization for decimal to string

2025-01-28 Thread Shaojin Wen
Continue to complete PR #16006 and PR #21593 to improve BigDecimal::toString and BigDecimal::toPlainString performance and reduce duplicate code - Commit messages: - simplify and comments - simplify - simplify - code style - revert change - bug fix - bug fix - refactor - Rev

RFR: 8315585: Optimization for decimal to string

2024-11-11 Thread Shaojin Wen
Continue to complete PR #16006 to improve performance and reduce duplicate code - Commit messages: - optimize BigDecimal toString/toPlainString - add benchmark Changes: https://git.openjdk.org/jdk/pull/22009/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22009&range=00

Re: RFR: 8315585: Optimization for decimal to string [v15]

2024-01-21 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v14]

2023-12-21 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v13]

2023-11-09 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v12]

2023-11-09 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-23 Thread Claes Redestad
On Mon, 23 Oct 2023 11:50:02 GMT, Shaojin Wen wrote: > Can I add scale2 method to StringLatin1? I'd strongly advice against this. > I think this is more readable than using MethodHandle. View the `MethodHandle`s you add to use `StringConcatFactory` here as a temporary workaround before the c

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

2023-10-23 Thread Shaojin Wen
On Thu, 19 Oct 2023 11:58:26 GMT, Claes Redestad wrote: >> @cl4es >> >>> Good, narrows it down to what's going on in `prepend(long, byte[], >>> String)`. Might boil down to `System.arraycopy`. This method might not be >>> optimized for tiny arrays on all platforms. Specializing for single-cha

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

2023-10-21 Thread Shaojin Wen
On Thu, 19 Oct 2023 10:22:19 GMT, Raffaello Giulietti wrote: >> I've opened up #16244 for review - thanks for helping with analysis and >> verification. > > @cl4es @wenshao I'd like to review the mathematical aspects of these changes > once the refactorings with string concatenations have stab

Re: RFR: 8315585: Optimization for decimal to string [v11]

2023-10-21 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-21 Thread Shaojin Wen
On Thu, 19 Oct 2023 11:58:26 GMT, Claes Redestad wrote: >> @cl4es >> >>> Good, narrows it down to what's going on in `prepend(long, byte[], >>> String)`. Might boil down to `System.arraycopy`. This method might not be >>> optimized for tiny arrays on all platforms. Specializing for single-cha

Re: RFR: 8315585: Optimization for decimal to string [v10]

2023-10-20 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v9]

2023-10-19 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-19 Thread Claes Redestad
On Thu, 19 Oct 2023 11:38:57 GMT, Shaojin Wen wrote: > In addition to #16244, will you submit a PR for this? Once both #16244 and this has been integrated I want to revisit this. The effect of changing `getBytes(byte[], int, byte)` might have disappeared with #16244 since it better guarantees

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

2023-10-19 Thread Shaojin Wen
On Wed, 18 Oct 2023 15:59:31 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use StringConcatFactory.makeConcatWithConstants > > I've opened up #16244 for review - thanks for helping with analysi

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

2023-10-19 Thread Raffaello Giulietti
On Wed, 18 Oct 2023 15:59:31 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use StringConcatFactory.makeConcatWithConstants > > I've opened up #16244 for review - thanks for helping with analysi

Re: RFR: 8315585: Optimization for decimal to string [v8]

2023-10-18 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-18 Thread Claes Redestad
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-18 Thread Claes Redestad
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-18 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-18 Thread Claes Redestad
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Chen Liang
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Shaojin Wen
On Tue, 17 Oct 2023 15:56:58 GMT, Chen Liang wrote: > Can you export jfr recordings of two different runs to check? How to do this? I don't know how yet - PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1767448022

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

2023-10-17 Thread Chen Liang
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Claes Redestad
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-16 Thread Claes Redestad
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-16 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Chen Liang
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Claes Redestad
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Claes Redestad
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Claes Redestad
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-15 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-15 Thread Claes Redestad
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Claes Redestad
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v5]

2023-10-13 Thread Claes Redestad
On Thu, 12 Oct 2023 21:49:00 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v5]

2023-10-12 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-12 Thread Claes Redestad
On Wed, 11 Oct 2023 21:46:04 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-12 Thread Claes Redestad
On Wed, 11 Oct 2023 22:19:29 GMT, Shaojin Wen wrote: > Keep the duplicate code of StringConcatHelper, or use JLA, or move the code > of getCharsLatin1 & stringSize to DecimalDigits (PR #15699). Of the three > options, using JLA is the smallest change. Adding methods to JLA also adds a maintena

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

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 09:50:20 GMT, Claes Redestad wrote: > I'm not really qualified to review the floating point code. Simplifying away > offset and getting rid of the StringBuilderHelper all seem like good > improvements, though I think it'd be good if we could either avoid or split > out the

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

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 22:10:45 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/math/BigDecimal.java line 4168: >> >>> 4166: int lowInt = (int)intCompact % 100; >>> 4167: int highInt = (int)intCompact / 100; >>> 4168: int highIntSize = JLA.stringSize(

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

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 09:48:58 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> refactor based on @liach 's review > > src/java.base/share/classes/java/math/BigDecimal.java line 4168: > >> 4166:

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

2023-10-11 Thread Shaojin Wen
> I submitted PR #1 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

Re: RFR: 8315585: Optimization for decimal to string [v3]

2023-10-11 Thread Shaojin Wen
> I submitted PR #1 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

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

2023-10-11 Thread Claes Redestad
On Mon, 9 Oct 2023 19:20:29 GMT, Shaojin Wen wrote: >> I submitted PR #1 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

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

2023-10-09 Thread 温绍锦
On Mon, 9 Oct 2023 19:20:29 GMT, 温绍锦 wrote: >> I submitted PR #1 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 per

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

2023-10-09 Thread 温绍锦
> I submitted PR #1 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 M

Re: RFR: 8315585: Optimization for decimal to string

2023-10-08 Thread 温绍锦
On Sun, 8 Oct 2023 15:30:00 GMT, Chen Liang wrote: > I think the String concat indy call site already generates code that computes > the size of the char array to be allocated (remember the lengthCoder from > String Concat). We can probably just use `highInt + '.' + > StringBuilderHelper.DIGIT

Re: RFR: 8315585: Optimization for decimal to string

2023-10-08 Thread Chen Liang
On Mon, 2 Oct 2023 05:40:03 GMT, 温绍锦 wrote: > I submitted PR #1 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 performa

Re: RFR: 8315585: Optimization for decimal to string

2023-10-04 Thread 温绍锦
On Mon, 2 Oct 2023 05:40:03 GMT, 温绍锦 wrote: > I submitted PR #1 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 performa

RFR: 8315585: Optimization for decimal to string

2023-10-04 Thread 温绍锦
I submitted PR #1 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 Pr

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

2023-10-04 Thread 温绍锦
On Fri, 8 Sep 2023 14:50:15 GMT, Claes Redestad wrote: > Seems like a step in the right direction w.r.t. code duplication. There's > still a lot going on in this PR so it'll take some time to digest. Is there > some way to split this into a series of enhancements for easier review? The > `jla.

Re: RFR: 8315585: Optimization for decimal to string [v15]

2023-09-19 Thread 温绍锦
On Thu, 14 Sep 2023 11:19:08 GMT, 温绍锦 wrote: >> BigDecimal is a commonly used class in business development, It is often >> necessary to perform toString or toPlainString operations on BigDecimal. >> >> The current version uses StringBuilder resulting in multiple memory >> allocations, I made

Re: RFR: 8315585: Optimization for decimal to string [v15]

2023-09-14 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v14]

2023-09-12 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v13]

2023-09-09 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v12]

2023-09-09 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v11]

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v10]

2023-09-08 Thread 温绍锦
On Fri, 8 Sep 2023 18:17:12 GMT, 温绍锦 wrote: >> BigDecimal is a commonly used class in business development, It is often >> necessary to perform toString or toPlainString operations on BigDecimal. >> >> The current version uses StringBuilder resulting in multiple memory >> allocations, I made a

Re: RFR: 8315585: Optimization for decimal to string [v10]

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v9]

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

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

2023-09-08 Thread 温绍锦
On Fri, 8 Sep 2023 16:25:27 GMT, Roger Riggs wrote: >> I'll have a look at #14655 though I note that @RogerRiggs has already >> commented that this might not carry its own weight. These internal API >> bridges are a nuisance so we need to take care to make sure that any >> addition is actually

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

2023-09-08 Thread Roger Riggs
On Fri, 8 Sep 2023 15:48:55 GMT, Claes Redestad wrote: >> Going from `jla.newStringNoRepl(bytes, ISO_...)` to >> `jla.newStringLatin1NoRepl(bytes)` isn't much of a code simplification, so >> this distracts a bit from the bulk of the changes in this PR. I agree that >> it *might* help inlining

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

2023-09-08 Thread 温绍锦
On Fri, 8 Sep 2023 15:48:55 GMT, Claes Redestad wrote: >> Going from `jla.newStringNoRepl(bytes, ISO_...)` to >> `jla.newStringLatin1NoRepl(bytes)` isn't much of a code simplification, so >> this distracts a bit from the bulk of the changes in this PR. I agree that >> it *might* help inlining

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

2023-09-08 Thread Claes Redestad
On Fri, 8 Sep 2023 15:41:41 GMT, Claes Redestad wrote: >> Notice there is patch https://github.com/openjdk/jdk/pull/14655 (bug >> 8310901) for converting these usages to a new `newStringLatin1NoRepl`. > > Going from `jla.newStringNoRepl(bytes, ISO_...)` to > `jla.newStringLatin1NoRepl(bytes)` i

Re: RFR: 8315585: Optimization for decimal to string [v8]

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

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

2023-09-08 Thread Claes Redestad
On Fri, 8 Sep 2023 15:39:47 GMT, Chen Liang wrote: >> newStringLatin1NoRepl does not significantly help performance, but it >> simplifies the code. >> >> Of course, there is another advantage: because the call will be simpler, >> making it easier for the caller method to implement codeSize sm

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

2023-09-08 Thread Chen Liang
On Fri, 8 Sep 2023 15:34:16 GMT, 温绍锦 wrote: >> src/java.base/share/classes/java/lang/String.java line 699: >> >>> 697: } >>> 698: >>> 699: static String newStringLatin1NoRepl(byte[] bytes) { >> >> How much does this help compared to calling `jla.newStringNoRepl(bytes, >> StandardChars

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

2023-09-08 Thread 温绍锦
On Fri, 8 Sep 2023 12:25:02 GMT, Claes Redestad wrote: >> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Continue to optimize and reduce duplicate code > > src/java.base/share/classes/java/lang/String.java line 699: > >> 697: }

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

2023-09-08 Thread Claes Redestad
On Fri, 8 Sep 2023 12:00:17 GMT, 温绍锦 wrote: >> BigDecimal is a commonly used class in business development, It is often >> necessary to perform toString or toPlainString operations on BigDecimal. >> >> The current version uses StringBuilder resulting in multiple memory >> allocations, I made a

Re: RFR: 8315585: Optimization for decimal to string [v3]

2023-09-08 Thread 温绍锦
On Tue, 5 Sep 2023 18:13:39 GMT, Claes Redestad wrote: >> 温绍锦 has updated the pull request with a new target base due to a merge or a >> rebase. The incremental webrev excludes the unrelated changes brought in by >> the merge/rebase. The pull request contains four additional commits since >> t

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

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-09-08 Thread 温绍锦
> BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory > allocations, I made a modification to improve performance. > > Because

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

2023-09-06 Thread 温绍锦
On Wed, 6 Sep 2023 03:34:04 GMT, 温绍锦 wrote: >> BigDecimal is a commonly used class in business development, It is often >> necessary to perform toString or toPlainString operations on BigDecimal. >> >> The current version uses StringBuilder resulting in multiple memory >> allocations, I made a

  1   2   >