Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Chen Liang
On Wed, 26 Jun 2024 14:55:44 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 17:42:13 GMT, Chen Liang wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> 1. revert code change. >> 2. comment remove space > > src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.java

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Claes Redestad
On Wed, 26 Jun 2024 14:55:44 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Chen Liang
On Wed, 26 Jun 2024 14:55:44 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Raffaello Giulietti
On Wed, 26 Jun 2024 14:55:44 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 14:22:03 GMT, Raffaello Giulietti wrote: >> I looked at it again and I think @cl4es 's suggestion is correct. Can I >> submit the change? @rgiulietti > > Of course, nothing has been approved as of now. > > Since you are preparing a commit anyway, may I ask you to revert bac

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v20]

2024-06-26 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v19]

2024-06-26 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Raffaello Giulietti
On Wed, 26 Jun 2024 14:17:47 GMT, Shaojin Wen wrote: >> Yeah, I'm just musing about the perils of leaking/replicating those >> implementation details, but as you say this is internal code only used by >> `String` and `StringBuilder` to it's loosely part of that complex. Not >> requesting any c

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 14:00:36 GMT, Claes Redestad wrote: >> I have written a version using boolean locally, but because this class is >> mainly used by String and StringBuilder, it uses the same style as >> String/StringBuilder. > > Yeah, I'm just musing about the perils of leaking/replicating t

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Claes Redestad
On Wed, 26 Jun 2024 13:23:14 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 47: >> >>> 45: static final int NAN = 5 << 8; >>> 46: >>> 47: static final byte LATIN1 = 0; >> >> I think this somewhat unnecessarily copies names and inter

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-26 Thread Raffaello Giulietti
On Wed, 26 Jun 2024 13:20:58 GMT, Shaojin Wen wrote: >> In principle, you should not arbitrarily change code that is correct, and >> only limit your changes to reach the goal of the PR. >> My suggestion is the minimal change required, yours is more than strictly >> needed. > > Got it, should I

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 13:14:13 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> from @liach: use s.getBytes for performance > > src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 47:

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 12:50:38 GMT, Raffaello Giulietti wrote: >> I like the new implementation, the code is cleaner, is your suggestion to >> revert to the original version due to smaller changes? > > In principle, you should not arbitrarily change code that is correct, and > only limit your ch

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-26 Thread Claes Redestad
On Tue, 25 Jun 2024 17:29:04 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-26 Thread Raffaello Giulietti
On Tue, 25 Jun 2024 17:02:10 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.java line 236: >> >>> 234: dk = -1; >>> 235: } >>> 236: return toDecimal(str, index, Q_MIN, t, dk, fd) - start; >> >> I sugge

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-26 Thread Shaojin Wen
On Wed, 26 Jun 2024 11:30:25 GMT, Raffaello Giulietti wrote: >> All suggestions have been fixed, can this PR be integrated? @cl4es @liach > > @wenshao Looks good, thanks for the improvements. > > Let me know when you are finished with your changes. > Once approved, you should refrain from addi

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-26 Thread Raffaello Giulietti
On Tue, 25 Jun 2024 01:58:29 GMT, Shaojin Wen wrote: >> Just suggesting some improvements > > All suggestions have been fixed, can this PR be integrated? @cl4es @liach @wenshao Looks good, thanks for the improvements. Let me know when you are finished with your changes. Once approved, you shou

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v18]

2024-06-25 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v17]

2024-06-25 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-25 Thread Shaojin Wen
On Tue, 25 Jun 2024 14:47:45 GMT, Raffaello Giulietti wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Utf16 case remove `append first utf16 char` > > src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.ja

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v16]

2024-06-25 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v15]

2024-06-25 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v14]

2024-06-25 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-25 Thread Raffaello Giulietti
On Mon, 17 Jun 2024 04:58:41 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-24 Thread Chen Liang
On Mon, 17 Jun 2024 04:58:41 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-24 Thread Shaojin Wen
On Sun, 16 Jun 2024 21:25:42 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> code format > > Just suggesting some improvements All suggestions have been fixed, can this PR be integrated? @cl4es

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-21 Thread Shaojin Wen
On Sun, 16 Jun 2024 21:00:41 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> code format > > src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 171: > >> 169: /* Using the dep

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]

2024-06-16 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-16 Thread Shaojin Wen
On Sun, 16 Jun 2024 23:49:18 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 169: >> >>> 167: } >>> 168: >>> 169: /* Using the deprecated constructor enhances performance */ >> >> Enhances performance over what, `new String(str, 0, index, >

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v12]

2024-06-16 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v11]

2024-06-16 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-16 Thread Shaojin Wen
On Sun, 16 Jun 2024 21:02:09 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> code format > > src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 169: > >> 167: } >> 168: >> 16

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v10]

2024-06-16 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v9]

2024-06-16 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-16 Thread Claes Redestad
On Sat, 15 Jun 2024 13:27:41 GMT, Shaojin Wen wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This pat

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v8]

2024-06-15 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v7]

2024-06-15 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v6]

2024-06-14 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v5]

2024-06-14 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v4]

2024-06-14 Thread Shaojin Wen
On Sat, 15 Jun 2024 02:45:40 GMT, Chen Liang wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> use JLA replace Unsafe > > src/java.base/share/classes/jdk/internal/math/ToDecimal.java line 41: > >> 39: public sealed c

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v4]

2024-06-14 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v3]

2024-06-14 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v2]

2024-06-14 Thread Shaojin Wen
> The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is just a code refactoring to reduce object allocation, b

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal

2024-06-14 Thread Shaojin Wen
On Sat, 15 Jun 2024 03:02:19 GMT, Chen Liang wrote: >> The current versions of FloatToDecimal and DoubleToDecimal allocate >> additional objects. Reducing these allocations can improve the performance >> of Float/Double.toString and AbstractStringBuilder's append(float/double). >> >> This patc

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal

2024-06-14 Thread Chen Liang
On Sat, 15 Jun 2024 01:59:42 GMT, Shaojin Wen wrote: > The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is

Re: RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal

2024-06-14 Thread Shaojin Wen
On Sat, 15 Jun 2024 01:59:42 GMT, Shaojin Wen wrote: > The current versions of FloatToDecimal and DoubleToDecimal allocate > additional objects. Reducing these allocations can improve the performance of > Float/Double.toString and AbstractStringBuilder's append(float/double). > > This patch is

RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal

2024-06-14 Thread Shaojin Wen
The current versions of FloatToDecimal and DoubleToDecimal allocate additional objects. Reducing these allocations can improve the performance of Float/Double.toString and AbstractStringBuilder's append(float/double). This patch is just a code refactoring to reduce object allocation, but does no