Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-27 Thread fabioromano1
> A faster and simpler way to generate random BigIntegers, avoiding eventually > trimming of leading zeros in magnitude array. fabioromano1 has updated the pull request incrementally with one additional commit since the last revision: Update BigInteger(int, Random) Update a comment

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-27 Thread Brian Burkhalter
On Mon, 27 Nov 2023 22:52:36 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/BigInteger.java line 754: >> >>> 752: // numInts >= 1, since numBits > 0 >>> 753: >>> 754: int firstInt = rnd.nextInt() & (-1 >>> -numBits); // Mask out >>> any excess bits >> >> Ins

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread fabioromano1
On Tue, 28 Nov 2023 01:08:43 GMT, Brian Burkhalter wrote: >> It's equivalent. If you watch the implementations of other methods in the >> class where a mask out is made, this method is often used. > > Indeed it looks as if that is correct. As specified in https://docs.oracle.com/javase/specs/j

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread Brian Burkhalter
On Tue, 28 Nov 2023 11:46:10 GMT, fabioromano1 wrote: >> Indeed it looks as if that is correct. > > As specified in > https://docs.oracle.com/javase/specs/jls/se21/html/jls-15.html#jls-15.19: > "If the promoted type of the left-hand operand is int, then only the five > lowest-order bits of the

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread Brian Burkhalter
On Mon, 27 Nov 2023 22:58:17 GMT, fabioromano1 wrote: >> A faster and simpler way to generate random BigIntegers, avoiding eventually >> trimming of leading zeros in magnitude array. > > fabioromano1 has updated the pull request incrementally with one additional > commit since the last revision

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread fabioromano1
On Mon, 27 Nov 2023 22:58:17 GMT, fabioromano1 wrote: >> A faster and simpler way to generate random BigIntegers, avoiding eventually >> trimming of leading zeros in magnitude array. > > fabioromano1 has updated the pull request incrementally with one additional > commit since the last revision

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread Brian Burkhalter
On Tue, 28 Nov 2023 18:11:25 GMT, Brian Burkhalter wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update BigInteger(int, Random) >> >> Update a comment > > Do you have any actual benchmark measurements that y

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread fabioromano1
On Tue, 28 Nov 2023 19:31:14 GMT, Brian Burkhalter wrote: >> Do you have any actual benchmark measurements that you could share? > >> @bplb I have not yet made benchmark measurements, but I can produce them. > > @fabioromano1 I think it would be good to measure and report the benefit, if > you

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-28 Thread fabioromano1
On Tue, 28 Nov 2023 19:31:14 GMT, Brian Burkhalter wrote: >> Do you have any actual benchmark measurements that you could share? > >> @bplb I have not yet made benchmark measurements, but I can produce them. > > @fabioromano1 I think it would be good to measure and report the benefit, if > you

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-11-30 Thread Roger Riggs
On Mon, 27 Nov 2023 22:58:17 GMT, fabioromano1 wrote: >> A faster and simpler way to generate random BigIntegers, avoiding eventually >> trimming of leading zeros in magnitude array. > > fabioromano1 has updated the pull request incrementally with one additional > commit since the last revision

Re: RFR: 8320759: Creation of random BigIntegers can be made faster [v2]

2023-12-02 Thread fabioromano1
On Thu, 30 Nov 2023 20:37:37 GMT, Roger Riggs wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update BigInteger(int, Random) >> >> Update a comment > > There are some JMH tests for BigInteger in > test/micro/