Framerate starting slow


#1

Hi,
I’ve been testing the frameRate on some of my programs lately, but I’ve noticed that when I first start the program, the frameRate always starts off around 15, then gradually goes up. I’m using a MacBook Air and wondering if this happens to anyone else. Here is my code:

void setup() {
  size(200,200);
}
void draw() {
  println(frameRate);
}

This is just a simple program, but when I’ve put it to my larger programs, the issue seems to get even worst. If anyone has any advice, or needs to ask a question, it would be greatly appreceated.

Thanks!


#2

Hi Sarah,

Check out the reference: https://processing.org/reference/frameRate.html

You can read that:

The system variable frameRate contains the approximate frame rate of a running sketch. The initial value is 10 fps and is updated with each frame. The value is averaged over several frames, and so will only be accurate after the draw function has run 5-10 times.

Si it’s completely normal :slight_smile:


#3

Thanks for your quick reply, I didn’t realize that it started off low, I should have read the reference before asking.

Since it starts off lower, will it affect the performance of the program too, or does it just display lower? In some of my other programs, at the start, it is very slow, but it becomes faster as the program progresses.


#4

The frame rate is not actually lower. It is just the variable that is.

If some of your programs start slow (meaning you can actually feel it is slow not because the frameRate variable tells you so) then something else is going on.


#5

Alright, I’ll try and figure out what else is making it slow. Thanks for all your help!