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

Reply via email to