I have four new JavaFX Graphics unit tests that copy bytes from a byte buffer to another byte buffer or write them to a byte channel [1]. They take less than 3 seconds to run under Ant, whether within NetBeans or from the command line.

Those same tests take 34 seconds to run in the JavaFX Gradle build, with or without the Gradle daemon, running on the same hardware in the same Ubuntu LXD container and with the same OpenJDK version 11.0.2.

When compiling, Ant passes "-g" while the Gradle build passes "-g:source,lines,vars" for the debugging information. Both Ant and Gradle pass the "-ea" option for the Java runtime to enable assertions.

I added statements to measure the timing of each test, and it appears they're executing more slowly within the test methods themselves:

$ ~/bin/ant.sh test

[junit] Testsuite: test.com.sun.glass.ui.monocle.FramebufferY8Test
[junit] FramebufferY8Test.onlyOnce: 2,212 ms
[junit] FramebufferY8Test.writeTo16: 258 ms
[junit] FramebufferY8Test.writeTo32: 105 ms
[junit] FramebufferY8Test.copyto16: 142 ms
[junit] FramebufferY8Test.copyto32: 34 ms
[junit] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0,
        Time elapsed: 2.839 sec

$ gradle --info :graphics:test

test.com.sun.glass.ui.monocle.FramebufferY8Test STANDARD_OUT
    FramebufferY8Test.onlyOnce: 2,290 ms
test.com.sun.glass.ui.monocle.FramebufferY8Test > copyTo16 STANDARD_OUT
    FramebufferY8Test.copyto16: 5,586 ms
test.com.sun.glass.ui.monocle.FramebufferY8Test > copyTo32 STANDARD_OUT
    FramebufferY8Test.copyto32: 10,763 ms
test.com.sun.glass.ui.monocle.FramebufferY8Test > writeTo16 STANDARD_OUT
    FramebufferY8Test.writeTo16: 5,376 ms
test.com.sun.glass.ui.monocle.FramebufferY8Test > writeTo32 STANDARD_OUT
    FramebufferY8Test.writeTo32: 10,608 ms

If I run Gradle with "--debug", I see extra "memory status events" that I don't see in other tests. Below is the "copyTo32" test, for example, which takes only 34 milliseconds for Ant but over 10 seconds for Gradle:

16:01:54.832 [DEBUG]
    [TestEventLogger]
    test.com.sun.glass.ui.monocle.FramebufferY8Test > copyTo32 STARTED
16:01:59.293 [LIFECYCLE]
    [org.gradle.process.internal.health.memory.MemoryManager]
16:01:59.293 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting OS memory status event
    {Total: 16705933312, Free: 14666444800}
16:01:59.293 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting JVM memory status event
    {Maximum: 4177526784, Committed: 314572800}
16:01:59.840 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting JVM memory status event
    {Maximum: 4177526784, Committed: 330301440}
16:02:04.294 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting OS memory status event
    {Total: 16705933312, Free: 14666657792}
16:02:04.294 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting JVM memory status event
    {Maximum: 4177526784, Committed: 314572800}
16:02:04.840 [DEBUG]
    [org.gradle.process.internal.health.memory.MemoryManager]
    Emitting JVM memory status event
    {Maximum: 4177526784, Committed: 330301440}
16:01:54.850 [LIFECYCLE]
    [org.gradle.internal.operations.DefaultBuildOperationExecutor]
16:01:54.850 [LIFECYCLE]
    [org.gradle.internal.operations.DefaultBuildOperationExecutor]
    > Task :graphics:test
16:02:05.229 [DEBUG]
    [TestEventLogger]
16:02:05.229 [DEBUG]
    [TestEventLogger]
    test.com.sun.glass.ui.monocle.FramebufferY8Test
        > copyTo32 STANDARD_OUT
16:02:05.229 [DEBUG]
    [TestEventLogger]
         FramebufferY8Test.copyto32: 10,397 ms
16:02:05.229 [DEBUG]
    [TestEventLogger]
16:02:05.229 [DEBUG]
    [TestEventLogger]
    test.com.sun.glass.ui.monocle.FramebufferY8Test > copyTo32 PASSED

I would appreciate any suggestions for what I might try next.

Thank you,
John

[1] https://github.com/javafxports/openjdk-jfx/blob/7a64f767fae875b154d36a4817ef1e25625c3143/modules/javafx.graphics/src/test/java/test/com/sun/glass/ui/monocle/FramebufferY8Test.java

Reply via email to