I've noticed a little performance decrese using rendering functions so I written a little script and I've got these results drawing 10000 filled boxes, the avarage is referred to each single box rendered:
Code: Select all
Display opened with its standard values.
-> Elapsed: 7581ms, Avarage:0.75
Display opened setting the software renderer = true.
-> Elapsed: 1105ms, Avarage:0.11
Display opened with software renderer = false, encapsulated the box rendering loop in BeginRefresh/EndRefresh.
-> Elapsed: 76ms, Avarage:0
Display opened with software renderer = true, encapsulated the box rendering loop in BeginRefresh/EndRefresh.
-> Elapsed: 1077ms, Avarage:0.1
It seems that it's not related with the VSync, infact with VSync enabled the rendering time increases a lot.
I don't understand if this is the normal behaviour or not
Here is my test script:
Code: Select all
/* This is a test to measure rendering */
@DISPLAY 1, { width = 800, height = 600 }
Local w, h = 800, 600
Local loops = 10000
SetFillStyle(#FILLCOLOR)
; SoftwareRenderer = Default (OFF)
; Refresh Block = None
DebugPrint("1. Display with its standard values and filled boxes.")
StartTimer(1)
For Local i = 0 To loops
Local x = Rnd(750)
Local y = Rnd(550)
Box(x, y, 50, 50, GetRandomColor())
Next
Local el = GetTimer(1)
DebugPrint("Elapsed: " .. el .. "ms, Avarage:" .. Int(el/loops*100)/100)
;--------------------------------
; SoftwareRenderer = ON
; Refresh Block = None
DebugPrint("2. Display with software renderer.")
CreateDisplay(2,
{ Width = 800,
Height = 600,
SoftwareRenderer = True
})
OpenDisplay(2)
CloseDisplay(1)
StartTimer(1)
For Local i = 0 To loops
Local x = Rnd(750)
Local y = Rnd(550)
Box(x, y, 50, 50, GetRandomColor())
Next
Local el = GetTimer(1)
DebugPrint("Elapsed: " .. el .. "ms, Avarage:" .. Int(el/loops*100)/100)
;--------------------------------
; SoftwareRenderer = OFF
; Refresh Block = Enabled
DebugPrint("3. Display with software renderer OFF + Refresh Block.")
CreateDisplay(3,
{ Width = 800,
Height = 600,
SoftwareRenderer = False
})
OpenDisplay(3)
CloseDisplay(2)
StartTimer(1)
BeginRefresh()
For Local i = 0 To loops
Local x = Rnd(750)
Local y = Rnd(550)
Box(x, y, 50, 50, GetRandomColor())
Next
EndRefresh()
Local el = GetTimer(1)
DebugPrint("Elapsed: " .. el .. "ms, Avarage:" .. Int(el/loops*100)/100)
;--------------------------------
; SoftwareRenderer = ON
; Refresh Block = Enabled
DebugPrint("4. Display with software renderer ON + Refresh Block.")
CreateDisplay(4,
{ Width = 800,
Height = 600,
SoftwareRenderer = True
})
OpenDisplay(4)
CloseDisplay(3)
StartTimer(1)
BeginRefresh()
For Local i = 0 To loops
Local x = Rnd(750)
Local y = Rnd(550)
Box(x, y, 50, 50, GetRandomColor())
Next
EndRefresh()
Local el = GetTimer(1)
DebugPrint("Elapsed: " .. el .. "ms, Avarage:" .. Int(el/loops*100)/100)
;--------------------------------
DebugPrompt("HIT ENTER TO CLOSE")