[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: New unit tests 12 times slower under Gradle (solved)
From:       Kevin Rushforth <kevin.rushforth () oracle ! com>
Date:       2019-02-12 19:48:09
Message-ID: 9dfc2302-ba18-36c2-9a77-323eecfbee20 () oracle ! com
[Download RAW message or body]

Hi John,

 > Mystery solved! Can we upgrade to JUnit 4.12 (and Hamcrest 1.3) in 
the build?

Yes, we can likely do this for openjfx13. As with any update to 
third-party code (or any new third-party code), we will need legal 
approval, which I can do.

On a somewhat-related topic, we will likely upgrade to gradle 5.x in 
this time frame as well.

-- Kevin


On 2/12/2019 11:25 AM, John Neffenger wrote:
> I figured it out. It's the old version of JUnit that we're using.
>
> Although we're building OpenJFX with Gradle 4.8, which bundles JUnit 
> 4.12, our "build.gradle" file specifies the older JUnit 4.8.2 (which 
> is downloaded, along with Hamcrest 1.1, into the Gradle cache under 
> "~/.gradle/caches").
>
> And JUnit 4.8.2 is more than 57 times slower than JUnit 4.12 when 
> comparing primitive arrays!
>
> The change that makes it so much faster is the call to 
> "Arrays.deepEquals", not found in the older version:
>
> public abstract class ComparisonCriteria {
>     public void arrayEquals(String message,
>             Object expecteds, Object actuals)
>             throws ArrayComparisonFailure {
>         if (expecteds == actuals
>             || Arrays.deepEquals(
>                 new Object[] {expecteds}, new Object[] {actuals})) {
>             // The reflection-based loop below is potentially very slow,
>             // especially for primitive arrays. The deepEquals check
>             // allows us to circumvent it in the usual case where the
>             // arrays are exactly equal.
>             return;
>         }
>         ...
>     }
>     ...
> }
>
> Mystery solved! Can we upgrade to JUnit 4.12 (and Hamcrest 1.3) in the 
> build?
>
> John


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic