Strange Render Speed Up

Blitz3D Forums/Blitz3D Userlibs/Strange Render Speed Up

I was working on a brightness control function for my Userlib when I noticed something very odd when timing it's speed. When my program initially starts, the processing loop takes about 150ms (720x480 Image on 3Ghz P4), but after about 10 seconds, the loop time goes down to 45ms.

Has anyone else noticed this behavior? Is there something going on with Blitz's Render Engine, like some self optimization?

Any takers? Here is the source code...

Graphics3D 640,480,0,2

im=LoadImage ("baby.bmp")

Brightness=1
	
While Not KeyHit(1)
	
	;Get Initial Time
	Start%=MilliSecs()

	;Get Keyboard Inputs
	If KeyHit(200) Then
		Brightness=Brightness+10
	EndIf
	
	If KeyHit(208) Then
		Brightness=Brightness-10
	EndIf	

        ;Render Area
	SetBuffer=BackBuffer
	
	Cls 
		
	;Make copy of original image
	im2=CopyImage (im)		
	
	;Adjust Image Brightness
	ImageBrightness (im2,0,Brightness)
	
	;Render to backbuffer
	DrawImage (im2,0,0)
	
	;Print elapsed time
	Locate 5,5
	Print "Up/Down to Adjust Brightness"
	Locate 5,25	
	Print "Elapsed Time:" + Str(MilliSecs()-start) + " ms"
	
	Flip 0

Wend


You can download the userlib here from my worklog..

http://www.blitzbasic.com/logs/userlog.php?user=7138&log=440