ewjordan
Ex Member
|
Java 6 skipping frames
May 3rd, 2008, 10:09pm
I didn't want to add this to the bugs db because I'm still not sure if it's actually a Processing bug or not. But I think it's worth discussing.
The issue I'm having is that whereas all of my Processing sketches seemed to work fine under Java <= 1.5, on computers with 1.6, graphical performance seems to be terrible, especially with processor intensive applets. The thing that's really bugging me is that with 1.5, if too much computation was happening for each frame, the frame rate would just drop, and everything would still be drawn. But with 1.6, it seems that a lot of frames are just never drawn.
Here's an example applet to check out (uses JBox2d for physics): http://www.jbox2d.org/demos/dominotower.html - it does a lot of computation, and in most cases triggers some fairly massive frame skipping with 1.6, in some cases losing five to ten frames for each one drawn. That uses Java2d as the renderer; an example with P3D is at http://www.jbox2d.org/v2demos/ (if you hit the left arrow about four times you'll hit the same domino tower stress test), and that seems to have the same issue. Java 5 runs slow but smooth, and Java 6 is jerky and ugly. Same thing if I change the JVM in Eclipse, btw, and the -server flag doesn't help at all. I'm not sure if this happens when Processing is not involved.
I originally thought this was a Windows Java 6 bug, but now that I've installed the OS X developer's preview of Java 6, I see that things are exactly the same on Mac. I've got to assume that something has changed drastically with the way threading is handled for applets - does anyone know exactly what has gone wrong, and whether this is something that can be worked around from the Processing end or not? The real problem is that whereas we can force a certain JVM from within Processing, on the web we're pretty much stuck with whatever people have installed, and Java 6's penetration is starting to grow substantially. Once people hit 6uN they'll be locked on to the most recent release for good, so it's going to get harder and harder to prefer older JVMs.
Speaking of which, Ben, do you have any recent stats on JVM versions for people visiting processing.org? I'm curious what the lay of the land is lately...
|