Animated Application - Why is paint invoked more often than update?

Trying to understand the JUCE graphic system a bit better, and can’t figure out why paint is invoked more often than update. If anything I would have assumed it would be the other way around.

So as a basic test I created an Animated Application in Projucer. In header I declared two int counter variables, initialized to zero, to keep track of how many times update is invoked, which off course should be the same as what is in setFramedPerSecond unless I make that too high, and how many times paint is actually invoked.

So my basic test code is;

void MainComponent::update()
{
	timerCounter++;
}

void MainComponent::paint (Graphics& g)
{
    g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));

	GUICounter++;

	g.setColour(Colours::white);
	g.drawText(String(timerCounter), 0, 0, 100, 20, true);
	g.drawText(String(GUICounter), 0, 20, 100, 20, true);
}

Too see what is going on I then make the update super slow, to one time per second setFramesPerSecond (1);

I can simply not understand why my two counter variables are not somewhat synchronized. Sure I understand when the application is run resized is invoked and it invokes paint. So at first the paint counter is a few ahead, but then a few updates later it suddenly jumps about +45 seemingly getting invoked +45 times! Then a bit later again +45, and then it does not seem to jump again, but at that point the paint counter is about 90 ahead of the update counter.

Discrepancy between the two, update() and paint(), remained the same, unless I set the frames per second impossible high.

For example the operating system may make spontaneous repaint requests. (Which system are you on?)

Is there some actual problem you are having because of that behavior? If your paint() calls take a long time, you may need to implement some kind of dirty flag that the paint() method can check to see if the repaint really needs to be done.

Windows 10. I am trying to find out what kind of timer works best for a game, that is almost done.