Skip to content

Frame skipping with processor intensive applets using 1.6 JVM #135

Closed

Description

@processing-bugs

Original author: b...@processing.org (June 07, 2010 01:03:28)

This bug automatically added from:
http://dev.processing.org/bugs/show_bug.cgi?id=766

Comment from ewjordan, 2008-05-04 16:49

Rev 0135
OS: Mac OS X 10.5.2, Windows XP SP2, Vista (not checked on Linux)
Java version 1.6

Using either Java2d or P3D with Java 1.6, sketches that do a lot of
computation per frame (enough to cause significant frame rate reduction)
are not only causing frame rate reduction, but actual skipping of frame draws.

An applet that usually causes this using Java2d is up at
http://www.jbox2d.org/demos/dominotower.html - the boxes flying at the
tower should be moving smoothly, which they do using a 1.5 VM, but with 1.6
installed, they skip several frames (unless your computer is really
fast...) between each one drawn.

I will see if I can put together a lightweight Processing sketch to test
this directly.

-ewjordan

Original issue: http://code.google.com/p/processing/issues/detail?id=96

Activity

  1. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From b...@processing.org on June 07, 2010 01:03:29
    Comment from ewjordan, 2008-05-04 17:09

    Okay, here's a simple sketch that illustrates the problem, set up to waste
    a lot of time in the draw method but keep the JVM from optimizing the loop
    away:

    void setup() {
    size(640,480);//,P3D);
    frameRate(60);
    }

    float x=0;
    float y=0;
    long wasteTime = 10000000;
    void draw() {
    background(255);
    stroke(0);
    rect(x,y,10,10);
    x += 10;
    y += 10;
    if (x>width) x = 0;
    if (y>width) y = 0;
    float x1 = width/2.0;
    float y1 = height/2.0;
    for (long i=0; i<wasteTime; ++i) {
    x1 += .0001_random(-1.0,1.0);
    y1 += .0001_random(-1.0,1.0);
    }
    ellipse(x1,y1,2,2);
    }

    You might have to tune the wasteTime variable for your computer. On mine
    (Vista with Java 1.6 installed, using the included JVM when in the PDE) it
    draws every frame when run from the PDE (the square should move exactly its
    own size each frame), but skips substantially when exported and loaded in a
    browser or run as an application. Switching to P3D the same problem
    exists; OpenGL seems fine.

  2. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From b...@processing.org on June 07, 2010 01:03:29
    Comment from fry, 2008-05-05 16:29

    k, thanks for tracking this down.

    to be clear, are you using the version of processing that includes java--so
    when run from the environment it's using 1.4, and then when you export/use
    a browser it's using 1.6? or is it something in how the sketch is running
    in the environment that is causing problems?

    we're making a move to drop 1.4 support, which means that we can rely on
    far better timing for threads and loops, so hopefully we'll be able to
    clear up some of this mess.

  3. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From b...@processing.org on June 07, 2010 01:03:30
    Comment from ewjordan, 2008-05-05 23:22

    (In reply to comment #2)

    to be clear, are you using the version of processing that includes java--so
    when run from the environment it's using 1.4, and then when you export/use
    a browser it's using 1.6? or is it something in how the sketch is running
    in the environment that is causing problems?

    That's right, I've got 1.4 running within the PDE, and everything runs
    fine, but when I export as application and run with my default VM set to
    1.6, massive frame skipping results. Switching my default JVM to 1.5 or
    1.4.2 fixes the skipping (though I do have to say, and this surprised me,
    overall speed is far better in 1.6, at least for this simple example and on
    OS X). Currently I can't test 1.6 within the browser on my Mac, but I've
    verified on XP and Vista that 1.6 skips a lot both within and outside of
    the browser, whereas 1.4.2 and 1.5 seem fine.

    I wouldn't worry too much about this, it's just a good test case to keep in
    mind when threading is revisited.

  4. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From b...@processing.org on June 07, 2010 01:03:30
    Comment from fry, 2008-05-06 20:51

    got it.. well, hopefully the shift to 1.5 will help since i can clean some
    things up.. sometime mid-summer when java 6u10 is released we may even
    start using that as the default included jre because of its size, speed,
    and startup advantages.. will have to see.

  5. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From b...@processing.org on June 07, 2010 01:03:31
    Comment from fry, 2008-08-15 08:54

    hopefully this is fixed in release 0145, which is now online. if you get a
    chance, please test and let me know.

  6. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From f...@processing.org on April 10, 2011 19:32:13
    Haven't seen this for a long time, closing.

  7. github-actions commented on Jun 18, 2021

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  8. locked as resolved and limited conversation to collaborators on Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    corehighimported

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions