Max2d performance?

BlitzMax Forums/BlitzMax Beginners Area/Max2d performance?

Here's an example.
If you want I can provide a blitz Directdraw as well as B3D pixel perfect spite versions implemented the same way that will beat the max version by X50. If its an issue with rebuilding all the textures in vram every frame then its a Max2d thing and not a vram thing, I have plenty of it and D3d version uses it properly.

Strict
Graphics 800,600,0,0
bglSetSwapInterval(0)

Global BMW
Global BMH
Global tileW
Global tileH
Const NUMTILES = 8	'// 8 tiles per side gives the best performance
Const MOVERATE = 12
Global OX#
Global OY#

Global aMap:Timage[NUMTILES ,NUMTILES ]
Print "loading bigmap.."
Load_Big_map("Image.jpg")	'// use any large image, something like 2600 x 2600 pixels

While Not KeyHit(KEY_ESCAPE)
	GetOrigin(OX,OY)
	If KeyDown(KEY_RIGHT) Then SetOrigin(OX-MOVERATE ,OY)
	If KeyDown(KEY_LEFT) Then SetOrigin(OX+MOVERATE ,OY)
	If KeyDown(KEY_UP) Then SetOrigin(OX,OY+MOVERATE )
	If KeyDown(KEY_DOWN) Then SetOrigin(OX,OY-MOVERATE )

	drawmap()
	DrawText fps(),500-OX,500
	
	bglSwapBuffers
	FlushMem
Wend

Global FPS_fpstime
  
Function FPS()
	Local oldtime
	Local elapsed
	Local fps_fps
	oldtime=FPS_fpstime
	FPS_fpstime=MilliSecs()
	elapsed=FPS_fpstime-oldtime
	If Not elapsed elapsed=1
	FPS_fps=1000/elapsed
	Return FPS_FPS
End Function

'------------------------------------------------------------------
Function Load_Big_map(file$)
	Local pmBig:TPixmap = LoadPixmap(file$)
	Local X
	Local Y

	BMW = PixmapWidth(pmBig)
	BMH = PixmapHeight(pmbig)
	TileW = PixmapWidth(pmBig) / NUMTILES
	TileH = PixmapHeight(pmbig) / NUMTILES
	Print tileW + "  " + TileH
	For X = 0 To NUMTILES -1
		Print X
		For Y = 0 To NUMTILES -1
			Print " " + y
			aMap:TImage[X,Y] = LoadImage( PixmapWindow(pmBig, TileW*X,TileH*Y,TileW ,TileH),-1 )	
		Next
	Next		
End Function
'------------------------------------------------------------------
Function DrawMap()
	Local X
	Local Y
	For X = 0 To NUMTILES -1
		For Y = 0 To NUMTILES -1
			'If (X*TileW > OX) And (Y*TileH > OY) Then
				DrawImage(aMap[X,Y],X*TileW,Y*TileH)
			'End If    		
		Next
	Next
End Function