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

fabioromano1 duke at openjdk.org
Thu Sep 12 11:26:11 UTC 2024


On Thu, 12 Sep 2024 10:27:49 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> 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 be used, etc.
> 
> Relying on random tests is good if the "search space" (the number of control flow paths) is too big for a systematic approach. But here I think it should be possible to exercise all paths with a dozen or so well targeted tests, in addition to the existing ones.
> 
> These are white-box tests, so the internal structure of the algorithms is supposed to be known and this knowledge should be exploited in trying to hit the weak points, if there are.

So, a test should be done for every possible path of computation of `MBI.leftShift()` method...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1756662312


More information about the core-libs-dev mailing list