Less Frames per Secs when compiled

Blitz3D Forums/Blitz3D Programming/Less Frames per Secs when compiled

Oliver Dorloechter(Posted 2005) [#1]
Hi, all. This is a problem I encountered this weekend. Donīt know if anybody else had this mentioned before.

The following Code results in 495 FPS when running on my PC (ATHLON XP 1900+, GeForce4 TI4400, NForce v6.6.93, B3D v1.90) within the IDE. After compiling to an EXE (DEBUG ON or OFF doesnīt matter) it will give me only 325 FPS. I donīt understand. Any ideas?


AppTitle "FPS Speed Test"

Graphics3D 1024, 768, 32,2
SetBuffer BackBuffer()
HidePointer

Global Camera = CreateCamera()

Light = CreateLight()

Cube = CreateCube()
PositionEntity Cube, 0, 0, 5

tex = CreateTexture(128, 128)
SetBuffer TextureBuffer(tex)
ClsColor 255,255,255
Cls
SeedRnd(MilliSecs())
For k = 1 To 50
Color Rand(256), Rand(256), Rand(256)
Rect Rand(128), Rand(128), Rand(128), Rand(128)
Next
EntityTexture Cube, tex
SetBuffer BackBuffer()
Color 255, 255, 255

FPS = 0
Ticks = 0
Timer = MilliSecs() + 1000

While Not KeyDown(1)
TurnEntity Cube, 0.05, 0.05, 0.05

UpdateWorld
RenderWorld

Ticks = Ticks + 1
If MilliSecs() >= Timer Then
FPS = Ticks
Ticks = 0
Timer = MilliSecs() + 1000
End If

Text 2, 2, "FPS: " + Str$(FPS)

Flip False
Delay 2
Wend

ShowPointer
EndGraphics
End


Rroff(Posted 2005) [#2]
Gives me the exact same speeds when compiled or running out the IDE. 342fps.

Do you have the latest versions of the IDE, linker, etc.?


Rroff(Posted 2005) [#3]
Just an aside, I'm not a fan of using that delay 2 for controlling the speed of execution myself.


Gabriel(Posted 2005) [#4]
Likewise.

I get:

495FPS in debug mode from the IDE,
495FPS in release mode from the IDE
495FPS in release mode from the EXE


All I can think of is that Flip False is unreliable in windowed mode, because Windows decides when you're going to flip. When not running the IDE, it's possible that the CPU has more free cycles and Windows uses those to flip the buffers more often. Do you get the same results in fullscreen?


Oliver Dorloechter(Posted 2005) [#5]
I think Sybixsus is right. Has something todo with windowed mode. I ran the above code in fullscreen mode. These are my results:

IDE (debug on) 492 FPS
IDE (debug off) 492 FPS
EXE (debug on) 492 FPS
EXE (debug off) 492 FPS

I only use the delay 2 when testing in windowed mode and donīt want to use the whole CPU power. In a final programm I would off cause allways remark this line for better performance. So I agree with you Rroff. Without the delay 2 the FPS is like this:

IDE (debug on) 1275 FPS
IDE (debug off) 1275 FPS
EXE (debug on) 1275 FPS
EXE (debug off) 1275 FPS

Thank you all very much for making this "windowed problem" clear to me.


Rroff(Posted 2005) [#6]
"I only use the delay 2 when testing in windowed mode and donīt want to use the whole CPU power." - fair enough then heh.