RFR: 8134459: java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java timed out
Paul Sandoz
paul.sandoz at oracle.com
Tue Jan 9 22:23:10 UTC 2018
This might also improve other tests using the same assert.
LambdaTestHelpers
--
s/if(/if (
+ int i = -1;
+ while (actual.hasNext() && expected.hasNext()) {
+ i++;
+ Object e = expected.next();
+ Object a = actual.next();
+ assertEquals(a, e, "Iterators differ");
+
+ }
‘i' is redundant. I presume might have wanted to use it to print out the index on element assertion failure, but it would of course induce garbage.
Paul.
> On 9 Jan 2018, at 13:15, Claes Redestad <claes.redestad at oracle.com> wrote:
>
> Hi,
>
> the java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java has
> started timing out locallty on my machine, and analyzing why it seems it simply has
> added enough test cases recently to hit the default 120s timeout.
>
> Quickly analyzing what is taking so much time I ran into an inefficiency in TestNGs
> assertEquals(Iterator<?>, Iterator<?>) implementation, where at least one error message
> string is created unconditionally in an inner loop, leading to quite a bit of allocation
> pressure in a test like WhileOpTest.
>
> On my machine, avoiding this extra work speeds up the test from taking around ~130s
> to ~100s. A good improvement, but still somewhat close to the default 120s timeout.
>
> So as a fix I propose:
>
> - work around this by providing simplified assert methods in the LambdaTestHelper that
> avoid the excessively allocating methods in TestNG
> - increasing the timeout of WhileOpTest to 240s
>
> http://cr.openjdk.java.net/~redestad/8134459/open.00/
>
> Regards
>
> /Claes
More information about the core-libs-dev
mailing list