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 › How fast is draw()
Page Index Toggle Pages: 1
How fast is draw() (Read 498 times)
How fast is draw()
Feb 8th, 2010, 9:54am
 
Hi, I'm totally new to Processing and full of enthusiasm.  Cheesy
But before I get started with some of my project ideas, I wanted to know how "fast" processing can actually get? I know, that I might be able to find the answer somewhere within the forum already, but a quick search didn't turn anything up, so please forgive me asking.

In an "ideal world", how often is the draw() function repeated? Say, if I only place one dot within the function, so that it's execution is not taking long, how many dots per second would I be able to get? (Of course this is not an exact question, as it will depend on CPU etc. But I want an estimate only.)
If I put something more complex into the draw() routine, say 10000 "bots" doing something which involves more calculations, will this reduce the amount of draw() calls per second, or would it lead to a crash? Can somebody give me some ideas of the limits/possibilities?

I know that I can slow down the draw(), but if I am interested in "fastest possible processing", how fast can I go?
Re: How fast is draw()
Reply #1 - Feb 8th, 2010, 10:16am
 
default framerate is 60 (at least it trys to).

The max for me is around 130/190 when nothing is drawn.
What kind of bots are you talking about, in a 3d or 2d space?
If you want to make the next CoD then you better learn c++.

My experience is atleast that processing is faster the AS2.0

Code:
PFont font;

void setup(){
font = createFont("LetterGothicStd",16);
frameRate(1000);
}

void draw(){
int tmr = millis();
background(255);
textFont(font,16);
fill(0);
text("fps: "+int(frameRate),20,20);
}
Re: How fast is draw()
Reply #2 - Feb 8th, 2010, 11:59am
 
I tried this to get an average fps over a period of time

Code:

long t, ct;
float et;
int n = 0;

void setup(){
 size(200,200);
 frameRate(1000);
 t= millis();
}

void draw(){
 ct = millis();
 et = (ct - t)/1000.0;
 n++;
 println(n / et);
}


and got

293.0
293.1111
293.22223
293.33334
292.95618
293.0671
293.17804
293.28894
293.39987
293.5108
293.62173
293.21225
293.323
293.43372
293.02533
293.13583
293.24637
293.3569


As clankill3r says it will depend very much on what you put inside your draw method but also the speed of your processor.
Page Index Toggle Pages: 1