Re: RFR: 8337279: Optimize format instant [v2]

2024-07-27 Thread Andriy Plokhotnyuk
On Fri, 26 Jul 2024 18:03:18 GMT, Roger Riggs wrote: > > Could you please review [these](https://github.com/openjdk/jdk/pull/11986) > > proposed changes for instantiation of `Instant` values with already > > normalized nanos? > > @plokhotnyuk Your contribution cannot be acted upon until the

Re: RFR: 8337279: Optimize format instant [v2]

2024-07-26 Thread Andriy Plokhotnyuk
On Fri, 26 Jul 2024 15:44:59 GMT, Shaojin Wen wrote: >> By removing the redundant code logic in >> DateTimeFormatterBuilder$InstantPrinterParser#formatTo, the codeSize can be >> reduced and the performance can be improved. > > Shaojin Wen has updated the pull request incrementally with one

Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16

2023-11-03 Thread Andriy Plokhotnyuk
On Fri, 3 Nov 2023 23:34:49 GMT, Claes Redestad wrote: > > @cl4es Could you please test > >

Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16

2023-11-03 Thread Andriy Plokhotnyuk
On Fri, 3 Nov 2023 12:03:24 GMT, Claes Redestad wrote: > https://github.com/cassioneri/eaf suggest this code for leap year calculation: > > public static boolean isLeap(long year) { > int d = year % 100 != 0 ? 4 : 16; > return (year & (d - 1)) == 0; > } > > .. with a

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Andriy Plokhotnyuk
On Wed, 13 Sep 2023 01:24:05 GMT, Shaojin Wen wrote: > 1. Reduce duplicate stringSize code > 2. Move java.lang.StringLatin1.getChars to > jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other > packages also need to use this method

Re: RFR: 8316150: Refactor get chars and string size [v7]

2023-09-22 Thread Andriy Plokhotnyuk
On Fri, 22 Sep 2023 09:22:04 GMT, 温绍锦 wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > > 温绍锦 has updated the pull request

Re: RFR: 8316662: Remove one allocation per conversion in Double.toString(double) and Float.toString(float)

2023-09-21 Thread Andriy Plokhotnyuk
On Thu, 21 Sep 2023 12:51:56 GMT, Raffaello Giulietti wrote: > By correctly sizing an intermediate `byte[]` and making use of the internal > `newStringNoRepl()` method, one allocation per conversion can be avoided when > the runtime uses compact strings. I bet that `decNumberOfTrailingZeros`

Re: RFR: 8310929: Optimization for Integer.toString [v13]

2023-08-31 Thread Andriy Plokhotnyuk
On Thu, 31 Aug 2023 02:36:09 GMT, 温绍锦 wrote: >> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> assert bounds check > > @cl4es can you help me to review this PR? @wenshao How about of approach used in James Anhalt's algorithm:

Re: RFR: 8302204: Optimize BigDecimal.divide

2023-02-16 Thread Andriy Plokhotnyuk
On Thu, 16 Feb 2023 16:51:43 GMT, Raffaello Giulietti wrote: > After making sure that `intVal` is even, and before attempting a division by > a power of 10, it might help to check if 5 divides `intVal` in the first > place. If it doesn't, there no point in performing the division. > > It can

Re: RFR: 8205592: BigDecimal.doubleValue() is depressingly slow

2023-02-14 Thread Andriy Plokhotnyuk
On Tue, 14 Feb 2023 14:07:22 GMT, Raffaello Giulietti wrote: >> Sorry, I overlooked those checks two times :) >> >> How about adding a moderate path like >>

Re: RFR: 8205592: BigDecimal.doubleValue() is depressingly slow

2023-02-14 Thread Andriy Plokhotnyuk
On Thu, 7 Jul 2022 15:20:32 GMT, Raffaello Giulietti wrote: > A reimplementation of `BigDecimal.[double|float]Value()` to enhance > performance, avoiding an intermediate string and its subsequent parsing on > the slow path. Sorry, I failed to recognize those checks two times :) How about

Re: RFR: 8205592: BigDecimal.doubleValue() is depressingly slow

2023-02-13 Thread Andriy Plokhotnyuk
On Tue, 31 Jan 2023 13:39:46 GMT, Raffaello Giulietti wrote: >> A reimplementation of `BigDecimal.[double|float]Value()` to enhance >> performance, avoiding an intermediate string and its subsequent parsing on >> the slow path. > > This PR is waiting for a review @rgiulietti Thanks for

Re: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2]

2023-01-30 Thread Andriy Plokhotnyuk
On Mon, 30 Jan 2023 08:41:25 GMT, Per Minborg wrote: > > java.time.ZoneOffset > > Maybe I am blind but can you provide a direct reference to an exising JDK > method in `java.time` where we can apply similar optimizations? No problem! We can start from `java.time.ZoneOffset` and its `parse`

Re: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2]

2023-01-04 Thread Andriy Plokhotnyuk
On Wed, 4 Jan 2023 12:40:43 GMT, Per Minborg wrote: > > @minborg Amazing piece! > > Will `java.lang.invoke.VarHandle` instances be shared in JDK to reuse in > > other places? > > The > >

Re: RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2]

2023-01-04 Thread Andriy Plokhotnyuk
On Wed, 4 Jan 2023 10:49:18 GMT, Per Minborg wrote: >> Do we need this test at all, because this code is tested to extense through >> RandomAccessFile? We had no test before, so why add a new one here? >> >> Otherwise: PR looks good. > >> Do we need this test at all, because this code is