Weird Frames Rates is the a garbage Problem?

BlitzMax Forums/BlitzMax Programming/Weird Frames Rates is the a garbage Problem?

Duckstab[o](Posted 2006) [#1]
SetGraphicsDriver GLMax2DDriver()
 
Graphics 1024,768,32

While Not KeyHit(KEY_SPACE)

For x=1 To 24
For y=1 To 70
DrawText curFps,x*40,y*10
Next
Next

curTime = MilliSecs()

If curTime > checkTime Then
	checkTime = curTime + 1000
	curFPS = fpscounter
	fpscounter = 0
Else
	fpscounter = fpscounter + 1
End If

'GCCollect()

Flip(0)
Cls
Wend


Try the above code once and you get erratic frame rates they seem to rise and fall in a seqence.

then try adding the gccollect function and the frame rate steadies


Duckstab[o](Posted 2006) [#2]
Without gccollect i get frame rates from 170-225 then it spikes to 550 plus before dropping back to 170

[edit]

This happens in a pattern has the gc been set to clean at timed periods or once gc reaches a certain level


Duckstab[o](Posted 2006) [#3]
Another Note

Have Checked This By running fraps along side and the frame rates are the same as the programme well within 1-2 so I cant see it being the code

Could this be a drawtext problem ?


Duckstab[o](Posted 2006) [#4]
SetGraphicsDriver GLMax2DDriver()
 
Graphics 1024,768,32

While Not KeyHit(KEY_SPACE)
DrawText curfps,10,10
For x=3 To 50
For y=1 To 75
DrawRect x*10,y*10,8,8
Next
Next

curTime = MilliSecs()

If curTime > checkTime Then
	checkTime = curTime + 1000
	curFPS = fpscounter
	fpscounter = 0
Else
	fpscounter = fpscounter + 1
End If

'GCCollect()

Flip(0)
Cls
Wend


Using this code the frame rate seems to be stable so it looks like it possible drawtext that is the problem.
maybe it causing to much garbage.

But on a second note if the value of curfps is replaced by "999" in the first example then the frame rate stays constant within 1-2.