PureBasic
Code: Select all
InitSprite()
InitKeyboard()
OpenScreen(640, 480, 16, "Sprite Test")
LoadSprite(0, "Data\nebula3.bmp", #PB_Sprite_Memory)
ChangeGamma(0,0,0,1)
timesum = 0
framesum = 0
timecheck = GetTickCount_()
Repeat
framesum = framesum + 1
oldtime = timecheck
timecheck = GetTickCount_()
deltatime = timecheck - oldtime
timesum = timesum + deltatime
If timesum >= 1000
frames = framesum / (timesum / 1000)
framesum = 0
timesum = timesum - 1000
EndIf
FlipBuffers()
DisplaySprite(0, 0, 0)
StartDrawing(ScreenOutput())
DrawingMode(1)
Locate(10,10) : DrawText("FPS: "+ Str(frames))
StopDrawing()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
Code: Select all
Graphics(640,480,16,1)
SetBuffer(BackBuffer())
Nebula = LoadImage("nebula3.bmp")
timesum = 0
framesum = 0
timecheck = MilliSecs()
Repeat
framesum = framesum + 1
oldtime = timecheck
timecheck = MilliSecs()
deltatime = timecheck - oldtime
timesum = timesum + deltatime
If timesum >= 1000
frames = framesum / (timesum / 1000)
framesum = 0
timesum = timesum - 1000
EndIf
Flip(False)
DrawBlock(Nebula,0,0)
Text(10,10,"FPS: "+ frames)
Until KeyHit(1)
End
PureBasic[640x480@32bit] - 275 FPS
PureBasic[640x480@16bit] - 520 FPS
Not bad! This is far higher FPS than anyone would ever need, but.. this is just drawing 1 image to the screen. Now lets look at BlitzBasic's results:
BlitzBasic[640x480@32bit] - 1111 FPS
BlitzBasic[640x480@16bit] - 2155 FPS
BlitBasic is almost exactly 4 times faster at this operation than PureBasic is(a little faster actually)! Why is this? It would seem that PureBasic would be faster, because they both use DirectX 7, but Blitz automatically updates the mouse and keyboard every frame, but PureBasic only does it when I tell it to(in this case, the mouse isn't updated at all). Also, BlitzBasic's text() command is notoriously very slow, could PureBasic's be even worse? I'm interested to find out what's going on here, as I was going to choose PureBasic for my game due to its robust features, but.. I also want my game to be able to be run well on very low-end machines, and BlitzBasic's blazing speed would do that very well.
I ran this test on my AMD Athlon 2400+, 512MB PC2100 DDR, ATI Radeon 8500 LE 128MB pc.