On Wed, 15 Dec 2021 14:31:26 GMT, kabutz <d...@openjdk.java.net> wrote:

>> src/java.base/share/classes/java/math/BigInteger.java line 2000:
>> 
>>> 1998:         da1 = a2.add(a0);
>>> 1999:         db1 = b2.add(b0);
>>> 2000:         var vm1_task = RecursiveOp.multiply(da1.subtract(a1), 
>>> db1.subtract(b1), parallel, depth + 1);
>> 
>> I recommend incrementing the depth in the `RecursiveOp` constructor, thereby 
>> reducing the repetition.
>
> Inside the constructor would not work, since we do not construct RecursiveOp 
> for all the tasks. However, I have incremented the parameter depth. I don't 
> like changing parameters inside methods, but since I'm doing it where it is 
> being used, I feel that the code is now better than before. Thanks for the 
> suggestion.

I am confused by "we do not construct RecursiveOp for all the tasks", since 
each call to `RecursiveOp.multiply/square` constructs a new object that is an 
instance of `RecursiveOp`. 

Your approach looks good.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6409

Reply via email to