Why does it take some time for my program to get up to speed?

Hello @adrinalino,

Scrutinize this code and give it a try:

int num = 1_000_000;

int t2;

void setup() 
  {
  size(1000, 800);
  frameRate(1000); // maximum possible it won't achieve this
  t2 = millis();
  }

void draw() 
  {
  background(0);
  float sum = 0;
  for (int i = 0; i < num; i++) 
    {
    float alfa0 = map(i, 0, num, 0, TAU);
    float alfa1 = map(i+1, 0, num, 0, TAU);
    sum += sin(alfa0) - sin(alfa1);
    sum -= cos(alfa0) + cos(alfa1);
    }
  
  //println(sum);
  noStroke();
  fill(0);
  rect(0, 0, 85, 25);
  fill(255);
  textSize(40);
  text("FPS  " + 1000.0*frameCount / millis(), 2, 40);
  text("FrameRate:  " + frameRate, 2, 80);
  text("FrameRate:  " + 1000.0/(millis()-t2), 2, 120);
  t2 = millis();
  }

I know that frameRate gives a rolling average so I used time between frames for real time updates.

Related:

Reference:

:)