SpeedTests

BlitzMax Forums/MiniB3D Module/SpeedTests

BLaBZ(Posted 2010) [#1]
Speed Test showing the common entity speed times, I was actually surprised to see how much more time moveentity requires compared to the other common entity functions,

I'm not sure of all the contingency's, but I think this works

SuperStrict 

Import sidesign.minib3d

Graphics3D(800,600,0,2,60)

Local t_load1:Int = MilliSecs()
Local ball:Tmesh = CreateSphere(20) 'LoadMesh("ball.b3d")
Local t_load2:Int = MilliSecs()
Local t_load:Int = t_load2 - t_load1

Local ball2:TMesh = CreateSphere(20)
PositionEntity(ball2,-20,20,20)

Local t_turn1:Int=MilliSecs()
For Local x:Int = 1 To 100000
	TurnEntity(ball,Rnd(0,180),Rnd(0,180),Rnd(0,180))
Next 
Local t_turn2:Int=MilliSecs()
Local t_turn:Int = t_turn2 - t_turn1

Local t_rotate1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	RotateEntity(ball,Rnd(0,180),Rnd(0,180),Rnd(0,180))
Next 
Local t_rotate2:Int = MilliSecs()
Local t_rotate:Int = t_rotate2 - t_rotate1

Local t_point1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	PointEntity(ball,ball2)
Next
Local t_point2:Int = MilliSecs()
Local t_point:Int = t_point2 - t_point1

Local t_form1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	TFormPoint(0,0,0,ball,ball2)
Next
Local t_form2:Int = MilliSecs()
Local t_form:Int = t_form2 - t_form1

Local t_formx1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	Local a:Int = TFormedX()
Next
Local t_formx2:Int = MilliSecs()
Local t_formx:Int = t_formx2 - t_formx1

Local t_position1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	PositionEntity(ball,Rnd(0,180),Rnd(0,180),Rnd(0,180))
Next	
Local t_position2:Int = MilliSecs()
Local t_position:Int = t_position2 - t_position1

Local t_move1:Int = MilliSecs()
For Local x:Int = 1 To 100000
	MoveEntity(ball,Rnd(0,180),Rnd(0,180),Rnd(0,180))
Next
Local t_move2:Int = MilliSecs()
Local t_move:Int = t_move2 - t_move1
	






Local camera:TCamera=CreateCamera()
PositionEntity(Camera,0,0,-10)

Local light:TLight=CreateLight()
PositionEntity(light,0,10,-10)

'Local cube:Tmesh=CreateCube()


While Not KeyHit(KEY_ESCAPE)

	UpdateWorld
	RenderWorld
	
	BeginMax2D()
	DrawText "LoadTime: " + t_load,0,0
	DrawText "TurnTime: " + t_turn,0,12
	DrawText "RotateTime: " + t_rotate,0,24
	DrawText "PointTime: " + t_point,0,36
	DrawText "TFormTime: " + t_form,0,48
	DrawText "TFormXCall: " + t_formx,0,60
	DrawText "PositionTime: " + t_position,0,72
	DrawText "MoveTime: " + t_move,0,84
	EndMax2D()
	
	Flip
	Cls 

Wend


I'm looking to boost the speeds(performance) of my game as much as possible, so if there are any suggestions please let me know!


SLotman(Posted 2010) [#2]
this is interesting... I converted the code back to B3D (just a matter of removing the declarations, and here's my results:

BMax/MiniB3D (official)
LoadTime: 9
TurnTime: 300
RotateTime: 295
PointTime: 310
TFormTime: 288
TFormXCall: 16
PositionTime: 292
MoveTime: 561

BMax/MiniB3D (my own version, Superstrict like the mini fixes)
LoadTime: 8
TurnTime: 290
RotateTime: 288
PointTime: 305
TFormTime: 248
TFormXCall: 17
PositionTime: 278
MoveTime: 559

Blitz3D
LoadTime: 1
TurnTime: 85
RotateTime: 77
PointTime: 89
TFormTime: 33
TFormXCall: 18
PositionTime: 25
MoveTime: 35

If anyone wants to compare versions (I replaced the original's DrawText with debuglog, so it's easier to copy/paste), here's B3D code:




H&K(Posted 2010) [#3]
Release

Load Time: 2
TurnTime: 51
RotateTime: 51
PointTime: 53
TformTime: 45
TFromXcall 1
Position Time: 48
Move time: 101

Debug

Load Time: 5
TurnTime: 207
RotateTime: 202
PointTime: 240
TformTime: 105
TFromXcall 12
Position Time: 197
Move time: 402


Obviously without B3d, or your system specs I can draw no conclusion, however my speed is comparable to yours if I build in Debug mode


Kryzon(Posted 2010) [#4]
Hmmm, try a hardcoded value instead of those RND()s.
It takes a few millis.


CloseToPerfect(Posted 2011) [#5]
Has anyone else test this on there on machine running both in MAX and 3d are the results the same with Blitz3d being that much faster?