RFR: 8336274: MutableBigInteger.leftShift(int) optimization [v7]
Raffaello Giulietti
rgiulietti at openjdk.org
Thu Sep 12 10:32:12 UTC 2024
On Wed, 11 Sep 2024 15:34:44 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> 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 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20008#discussion_r1756585001
More information about the core-libs-dev
mailing list