Re: RFR: 8327791: Optimization for new BigDecimal(String) [v16]

2024-03-27 Thread Shaojin Wen
On Wed, 20 Mar 2024 22:56:38 GMT, Shaojin Wen wrote: >> The current BigDecimal(String) constructor calls String#toCharArray, which >> has a memory allocation. >> >> >> public BigDecimal(String val) { >> this(val.toCharArray(), 0, val.length()); // allocate char[] >> } >> >> >> When the

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v16]

2024-03-26 Thread Claes Redestad
On Wed, 20 Mar 2024 22:56:38 GMT, Shaojin Wen wrote: >> The current BigDecimal(String) constructor calls String#toCharArray, which >> has a memory allocation. >> >> >> public BigDecimal(String val) { >> this(val.toCharArray(), 0, val.length()); // allocate char[] >> } >> >> >> When the

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v16]

2024-03-20 Thread Chen Liang
On Thu, 21 Mar 2024 00:40:45 GMT, Shaojin Wen wrote: > Should we declare the BigDecimal(CharSequence,MathContext) method as public? > Scenarios like >

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v16]

2024-03-20 Thread Shaojin Wen
On Wed, 20 Mar 2024 22:56:38 GMT, Shaojin Wen wrote: >> The current BigDecimal(String) constructor calls String#toCharArray, which >> has a memory allocation. >> >> >> public BigDecimal(String val) { >> this(val.toCharArray(), 0, val.length()); // allocate char[] >> } >> >> >> When the

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v16]

2024-03-20 Thread Shaojin Wen
> The current BigDecimal(String) constructor calls String#toCharArray, which > has a memory allocation. > > > public BigDecimal(String val) { > this(val.toCharArray(), 0, val.length()); // allocate char[] > } > > > When the length is greater than 18, create a char[] > > > boolean