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