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.
IndexProgramming Questions & HelpSyntax Questions › draw optimizations
Page Index Toggle Pages: 1
draw optimizations? (Read 342 times)
draw optimizations?
Jun 27th, 2008, 3:22am
 
I was wondering: does processing at some lower level optimize draw() by not re-processing consecutive frames that are identical (or ALMOST all pixels identical, for that matter)?  Or is the only inherent optimization the fact that certain resources might be cached?  

I would like to get an idea of how many of my potentially-repetitive calculations I should save the result for later frames.
Re: draw optimizations?
Reply #1 - Jun 27th, 2008, 8:56am
 
Certainly not. Processing just does what you ask it to do. If your draw() method call background() at each frame and display a thousand squares at the very same place, then Processing will just run the code : clear the background and display the squares, even though it will give the same result on the screen at each frame. For such "consecutive frames re-processing" software optimizations, you have to do the job if you want it to be done.

Processing optimizes hardware display by offering double-buffering, OPENGL rendering... and every little things that make our programming practice easier ;-)
Re: draw optimizations?
Reply #2 - Jun 27th, 2008, 6:54pm
 
It's certainly not automatic, but one thing you can do to reclaim what would otherwise be wasted CPU cycles from redrawing the same thing over and over again is tell Processing to temporarily halt the draw loop. See the documentation for noLoop().
Page Index Toggle Pages: 1