Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8107970

Animation drops frames but repeats keyframes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • fx1.2
    • javafx
    • None
    • Vista SP2, JDK 6u14, JavaFX 1.2

    Description

      I was running a very heavy test - my JavaFX Balls benchmark - in a configuration thatshould deliver a performance of only ~2fps. But the program was reporting more than double, with a custom FPS counter that relies on invocations of the main animation Timeline (that uses time:0). I investingated this by logging the nanoTime(0 for each call to the Timeline's action, and I got this:

      244768994737808 (delta: 467ms)
      244769462624160 (delta: 13ms)
      244769475647323 (delta: 13ms)
      244769941612132 (delta: 465ms)
      244769954661486 (delta: 13ms)
      ...

      So it seems that frames are produced each ~465ms, but the timeline is sometimes fired more than once between consecutive frames. This breaks my FPS score because I increment the frame counter in these events. The keyframe has canSkip:true, so any skipped animation frame should also skip the keyframe's action. The docs of canSkip say: "Timeline cycles are skipped between time pulses. If true, only one call to the action() function will occur for each time pulse, regardless of how many cycles have occured since the last time pulse was processed." Although it mentions "each time pulse" and not "each rendered frame", I see no reason for the observed behavior.

      To reproduce: run the attached project, click G to start animation, right arrow several times to select 512 Balls, then E to activate Effects and/or I for toggling to Vector rendering. This will make the animation extremely slow, and it's easy to notice that reported FPS is too high.

      Attachments

        Issue Links

          Activity

            People

              bchristi Brent Christian
              odoederlejfx Osvaldo Pinali Doederlein (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: