We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › Strange Performance Issue with OpenGL
Page Index Toggle Pages: 1
Strange Performance Issue with OpenGL (Read 1725 times)
Strange Performance Issue with OpenGL
May 29th, 2007, 12:38pm
 
I've been working on an OpenGL program, and I've noticed something very odd.  About 1 in every 10 times I run the program, I get a significant performance increase, but if I exit the program and run it again, it's back to normal (slower) speed.  It seems to happen regardless of the program's actual load on the system, and without a change in the build - just running the program a second or third time sometimes triggers the great performance increase.

Looking at the task manager, during normal execution, the program takes ~50% of the CPU, as may be expected when running a core at capacity.  However, on the odd high performance run, the CPU is only running at 5% or so, indicating greater than 10x performance increase, since it will also run at a higher framerate.

This indicates to me that perhaps OpenGL's hardware acceleration query is often failing when it shouldn't, and it's reverting to a fallback most of the time, with the odd high performance sessions being OpenGL running as it should.

My system is:
2.4 GHz Intel Core 2 Duo with
2 GB of RAM and
NVIDIA 8800GTX graphics card running on
Windows Vista
Re: Strange Performance Issue with OpenGL
Reply #1 - May 29th, 2007, 7:28pm
 
I'm also having this problem. I've isolated the slow code to the endShape() method, but have no idea how I'd go about profiling the sketch to see which part of all the stuff that gets executed inside that method is taking the most time. I'm on a 3.40 GHz Pentium D with 2 GB Ram and also an 8800GTX graphics card. I haven't reported a bug because I have no idea how to go about reproducing it reliably. But, if as Keldor suggests, Processing is falling back on P3D when it doesn't properly discover opengl capabilities, that might explain it.
Re: Strange Performance Issue with OpenGL
Reply #2 - Jun 24th, 2007, 1:12am
 
we don't fallback to P3D, it's probably more likely to be a strange timing/frameRate issue--i.e. System.currentTimeMillis() being inaccurate and returning bad numbers to make things run slowly perhaps.

endShape() is where all the magic happens, so the majority of cpu will be burned inside endShape().

but if you can find a way to reproduce this reliably, i'd love to find it and track it down.
Re: Strange Performance Issue with OpenGL
Reply #3 - Jun 24th, 2007, 7:23pm
 
i'm gonna close this topic for now. if you see it happening again, please file it in the bugs db so we can follow up on it properly.
Page Index Toggle Pages: 1