Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-02-28 Thread Daniel JeliƄski
On Mon, 22 Jan 2024 18:52:32 GMT, fabioromano1 wrote: >> As you note, that would probably require two divisions. I don't know if the >> JIT compiler can detect that the arguments are the same and emit just one >> division instead. >> I think your code is good enough for the purpose of

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v4]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 21:26:39 GMT, Brian Burkhalter wrote: >> @bplb It is not used in jtreg testing. > > So it is only for verification purposes in the context of this PR? @bplb Yes, it is. - PR Review Comment: https://git.openjdk.org/jdk/pull/17291#discussion_r1462444386

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v4]

2024-01-22 Thread Brian Burkhalter
On Mon, 22 Jan 2024 21:21:53 GMT, fabioromano1 wrote: >> test/jdk/java/math/BigInteger/TestDivWord.java line 5: >> >>> 3: import java.util.Random; >>> 4: >>> 5: public class TestDivWord { >> >> Where is this used in actually jtreg testing? > > @bplb It is not used in jtreg testing. So it is

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v4]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 20:02:34 GMT, Brian Burkhalter wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update TestDivWord.java >> >> Added method to check results of divWord > >

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v4]

2024-01-22 Thread Brian Burkhalter
On Mon, 22 Jan 2024 18:52:43 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 18:07:49 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > As you note, that would probably require two divisions. I don't know if the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v4]

2024-01-22 Thread fabioromano1
> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of > Hacker's Delight (2nd ed), section 9.3, the same used in > `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, > to get the computation faster. fabioromano1 has updated the pull request

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 18:07:49 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > As you note, that would probably require two divisions. I don't know if the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread Raffaello Giulietti
On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 17:23:22 GMT, Raffaello Giulietti wrote: > AFAIK, IntrinsicCandidate methods are only relevant in JIT compiled code. A > test that checks correctness might not reach the compilation stage, and > execute only in the bytecode interpreter. > > But IMO using the result of

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread Raffaello Giulietti
On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 16:15:57 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > What about splitting the result of `divWord()` into its components `q` and >

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread Raffaello Giulietti
On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 15:38:08 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > Sure. But the purpose of a test is not much to check the _current_ code but

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 15:38:08 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > Sure. But the purpose of a test is not much to check the _current_ code but

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread Raffaello Giulietti
On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread fabioromano1
On Mon, 22 Jan 2024 15:14:58 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed trailing whitespaces > > The test does not seem to check that the results are correct, but just >

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-22 Thread Raffaello Giulietti
On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 wrote: >> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of >> Hacker's Delight (2nd ed), section 9.3, the same used in >> `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, >> to get the

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int)

2024-01-09 Thread fabioromano1
On Mon, 8 Jan 2024 18:20:09 GMT, Brian Burkhalter wrote: > Do you have any benchmark results demonstrating the increased throughput? I just uploaded a class for random tests. But during the execution, I've found a non banal problem concerning the old implementation's running time. The problem

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

2024-01-09 Thread fabioromano1
> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of > Hacker's Delight (2nd ed), section 9.3, the same used in > `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, > to get the computation faster. fabioromano1 has updated the pull request

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v2]

2024-01-09 Thread fabioromano1
> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of > Hacker's Delight (2nd ed), section 9.3, the same used in > `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, > to get the computation faster. fabioromano1 has updated the pull request with

Re: RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int)

2024-01-08 Thread Brian Burkhalter
On Sat, 6 Jan 2024 18:01:01 GMT, fabioromano1 wrote: > The method `MutableBigInteger.divWord(long, int)` can use the algorithm of > Hacker's Delight (2nd ed), section 9.3, the same used in > `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, > to get the computation

RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int)

2024-01-08 Thread fabioromano1
The method `MutableBigInteger.divWord(long, int)` can use the algorithm of Hacker's Delight (2nd ed), section 9.3, the same used in `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, to get the computation faster. - Commit messages: - Merge branch