Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-02 Thread duke
On Tue, 1 Oct 2024 14:21:19 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-02 Thread Raffaello Giulietti
On Tue, 1 Oct 2024 20:43:24 GMT, fabioromano1 wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Code simplification > > `/integrate` @fabioromano1 Seems like your integration was not successful. Retry without any fo

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread fabioromano1
On Tue, 1 Oct 2024 14:21:19 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread fabioromano1
On Tue, 1 Oct 2024 14:21:19 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread Raffaello Giulietti
On Tue, 1 Oct 2024 14:21:19 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread fabioromano1
On Tue, 1 Oct 2024 15:34:12 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Code simplification > > test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 69: > >> 67: @M

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread Raffaello Giulietti
On Tue, 1 Oct 2024 14:21:19 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v15]

2024-10-01 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v14]

2024-10-01 Thread Raffaello Giulietti
On Sat, 28 Sep 2024 07:30:18 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v14]

2024-10-01 Thread Raffaello Giulietti
On Tue, 1 Oct 2024 09:02:36 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Small correction to ensure n > leadingZeros && nBits > leadingZeros > > test/jdk/java/math/BigInteger/MutableBig

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v16]

2024-10-01 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v17]

2024-10-01 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v14]

2024-09-28 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v13]

2024-09-27 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v12]

2024-09-27 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v11]

2024-09-27 Thread Raffaello Giulietti
On Thu, 12 Sep 2024 20:49:49 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-27 Thread fabioromano1
On Tue, 3 Sep 2024 16:50:26 GMT, fabioromano1 wrote: >>> > It would be nice to see some benchmarks where it gives performance >>> > benefits. >>> >>> @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe >>> there the benefits are more visible... >> >> "maybe" >> So,

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-27 Thread Raffaello Giulietti
On Tue, 3 Sep 2024 16:50:26 GMT, fabioromano1 wrote: >>> > It would be nice to see some benchmarks where it gives performance >>> > benefits. >>> >>> @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe >>> there the benefits are more visible... >> >> "maybe" >> So,

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v11]

2024-09-12 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v10]

2024-09-12 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread Raffaello Giulietti
On Thu, 12 Sep 2024 12:27:01 GMT, fabioromano1 wrote: >> I mean something like >> >> private void primitiveRightShift(int n, int[] result, int resPos) { >> int[] val = value; >> int n2 = 32 - n; >> int c = 0; >> for (int i = 0; i < intLen; i++) { >>

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-12 Thread fabioromano1
On Thu, 12 Sep 2024 12:21:59 GMT, Raffaello Giulietti wrote: >> So, a test should be done for every possible path of computation of >> `MBI.leftShift()` method... > > Looking at the code of `leftShift()` alone, I roughly count a dozen or so > paths. > But if you feel confident that the random

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread fabioromano1
On Thu, 12 Sep 2024 12:01:47 GMT, Raffaello Giulietti wrote: >> Yes, it could, but the problem is that in this way the precondition `(resPos >> <= offset || resPos >= offset + intLen)` would be no longer correct, and in >> particular `resPos <= offset` is used by `MBI.leftShift()` if `result =

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-12 Thread Raffaello Giulietti
On Thu, 12 Sep 2024 11:21:10 GMT, fabioromano1 wrote: >> The implementation of the shift methods in `MutableBigInteger` has several >> control flow paths, depending on whether a new `int[]` is needed, whether >> `arraycopy()` can be used, etc. >> >> Relying on random tests is good if the "sear

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread Raffaello Giulietti
On Thu, 12 Sep 2024 11:23:24 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 722: >> >>> 720: * {@code (resPos <= offset || resPos >= offset + intLen)}. >>> 721: */ >>> 722: private final void primitiveRightShift(int n, int[] result, in

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-12 Thread fabioromano1
On Thu, 12 Sep 2024 10:27:49 GMT, Raffaello Giulietti wrote: >> I see (with obvious adaptations and one more `case`). > > The implementation of the shift methods in `MutableBigInteger` has several > control flow paths, depending on whether a new `int[]` is needed, whether > `arraycopy()` can b

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread fabioromano1
On Thu, 12 Sep 2024 10:29:24 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use supported annotation by jtreg in tests > > src/java.base/share/classes/java/math/MutableBigInteger.java lin

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread fabioromano1
On Thu, 12 Sep 2024 10:27:39 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use supported annotation by jtreg in tests > > src/java.base/share/classes/java/math/MutableBigInteger.java lin

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-12 Thread Raffaello Giulietti
On Wed, 11 Sep 2024 15:34:44 GMT, Raffaello Giulietti wrote: >> The test cases of the code are the same of the test class for >> `BigInteger.shiftLeft()`. > > I see (with obvious adaptations and one more `case`). The implementation of the shift methods in `MutableBigInteger` has several contr

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-12 Thread Raffaello Giulietti
On Wed, 11 Sep 2024 15:51:25 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v9]

2024-09-11 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-11 Thread Raffaello Giulietti
On Wed, 11 Sep 2024 12:44:54 GMT, fabioromano1 wrote: >> test/jdk/java/math/BigInteger/MutableBigIntegerShiftTests.java line 153: >> >>> 151: >>> 152: return result; >>> 153: } >> >> I think this is getting too complex for a test, there's a risk that it is >> incorrect... >> >> I

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v8]

2024-09-11 Thread Raffaello Giulietti
On Wed, 11 Sep 2024 14:23:40 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v8]

2024-09-11 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-11 Thread fabioromano1
On Wed, 11 Sep 2024 11:48:36 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Merge branch 'patchLeftShift' of https://github.com/fabioromano1/jdk into >> patchLeftShift >> - Removed re

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-11 Thread Raffaello Giulietti
On Sat, 7 Sep 2024 20:39:39 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]

2024-09-07 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v6]

2024-09-04 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread Raffaello Giulietti
On Mon, 2 Sep 2024 16:19:01 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread Sergey Kuksenko
On Mon, 2 Sep 2024 16:19:01 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread fabioromano1
On Tue, 3 Sep 2024 16:29:10 GMT, Sergey Kuksenko wrote: >>> It would be nice to see some benchmarks where it gives performance benefits. >> >> @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe >> there the benefits are more visibles... > >> > It would be nice to see so

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread Sergey Kuksenko
On Tue, 3 Sep 2024 15:49:01 GMT, fabioromano1 wrote: > > It would be nice to see some benchmarks where it gives performance benefits. > > @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe > there the benefits are more visible... "maybe" So, you don't have proof th

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread Raffaello Giulietti
On Tue, 3 Sep 2024 15:49:01 GMT, fabioromano1 wrote: >> It would be nice to see some benchmarks where it gives performance benefits. > >> It would be nice to see some benchmarks where it gives performance benefits. > > @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread fabioromano1
On Tue, 3 Sep 2024 14:03:16 GMT, Sergey Kuksenko wrote: > It would be nice to see some benchmarks where it gives performance benefits. @kuksenko Try to run the benchmark of the `BigInteger`'s square root, maybe there the benefits are more visibles... - PR Comment: https://git.open

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-03 Thread Sergey Kuksenko
On Mon, 2 Sep 2024 16:19:01 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-02 Thread Raffaello Giulietti
On Mon, 2 Sep 2024 16:19:01 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v4]

2024-09-02 Thread Raffaello Giulietti
On Sun, 1 Sep 2024 16:32:00 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-02 Thread fabioromano1
On Mon, 2 Sep 2024 16:34:07 GMT, Raffaello Giulietti wrote: > Right, I didn't remember that `BigInteger` has its own implementation. > > However, reducing `MutableBigIntegerBox` to just a bunch of accessors to use > in the unit test and the benchmarks should still be possible. Then having two

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-02 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v5]

2024-09-02 Thread Raffaello Giulietti
On Mon, 2 Sep 2024 16:19:01 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the v

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v4]

2024-09-02 Thread fabioromano1
On Mon, 2 Sep 2024 16:04:14 GMT, Raffaello Giulietti wrote: > * I wonder if `MutableBigIntegerBox` can be reduced to just a set of > accessors for the `MutableBigInteger` fields. Also, I guess that the > benchmarks can be written to use the public class `BigInteger` to avoid > having two copi

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v4]

2024-09-01 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v3]

2024-09-01 Thread Raffaello Giulietti
On Sat, 31 Aug 2024 15:05:58 GMT, fabioromano1 wrote: >> This implementation of MutableBigInteger.leftShift(int) optimizes the >> current version, avoiding unnecessary copy of the MutableBigInteger's value >> content and performing the primitive shifting only in the original portion >> of the

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v3]

2024-08-31 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v2]

2024-08-07 Thread fabioromano1
> This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value array rather than in the value yet extended with trail

Re: RFR: 8336274: MutableBigInteger.leftShift(int) optimization

2024-07-12 Thread Chen Liang
On Wed, 3 Jul 2024 14:17:37 GMT, fabioromano1 wrote: > This implementation of MutableBigInteger.leftShift(int) optimizes the current > version, avoiding unnecessary copy of the MutableBigInteger's value content > and performing the primitive shifting only in the original portion of the > value

RFR: 8336274: MutableBigInteger.leftShift(int) optimization

2024-07-12 Thread fabioromano1
This implementation of MutableBigInteger.leftShift(int) optimizes the current version, avoiding unnecessary copy of the MutableBigInteger's value content and performing the primitive shifting only in the original portion of the value array rather than in the value yet extended with trailing zero