Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparison QB64 compiled with gcc optimizations and without
#24
thanks Jack. i came to the same conclusion. even with _Limit 40 it doesn't change anything. no speed gain. it seems that using _Limit distorts the result. the goal is to know if the _PutImage command is optimizable, I removed _Limit. it's too fast to compare, so I added a loop for a 10 times display.

Picture unroller. Author James D Jarvis. Found in the forum.

1.3x seconds : program compiled with qb64 -O3
2.5x program compiled with original qb64

this time the gain is visible.

Code: (Select All)
' James D Jarvis : Picture unroller
img& = _LoadImage("pic3.jpg", 32) 'your image here
w = _Width(img&)
h = _Height(img&)
sc& = _NewImage(w, h, 32)
Screen sc&
_Delay 0.1
_ScreenMove _Middle
Cls: s = 3
start = Timer(.001)
For boucle% = 1 To 10
    Cls
    For yc = 0 To h Step s
        _PutImage (0, 0), img&, sc&, (0, 0)-(w, yc)
        _PutImage (0, yc - 6)-(w, yc + 6), img&, sc&, (0, yc)-(w, yc + 3)
    Next yc
Next boucle%
Print Timer(.001) - start; "seconds"


Another example.

New screen - How ?. Found in the old forum.

1.4x seconds : program compiled with qb64 -O3
2.3x seconds : program compiled with original qb64

if you uncomment the line '_Limit 30, the gain will be zero. if you want to test, put 100 instead of 1000 in the loop.

Code: (Select All)
Screen1 = _NewImage(640, 480, 32)
Screen2 = _NewImage(640, 480, 32)
$Color:32
_Dest Screen1
Cls , Yellow
_PrintString (100, 240), "This is Screen 1"
_Dest Screen2
Cls , Red
_PrintString (340, 240), "This is Screen 2"
DefaultScreen = _NewImage(1300, 768, 32)
Screen DefaultScreen
_Delay 0.2
_ScreenMove _Middle
start = Timer(.001)
For boucle% = 1 To 1000
    _Dest Screen1
    Locate 3, 5: Print Time$ 'works on unvisible screen1 - print time$
    _Dest Screen2
    Circle (Rnd * 640, Rnd * 480), 10, _RGB32(255 * Rnd, 255 * Rnd, 255 * Rnd) 'works on unvisible Screen2 - draw circle
    _Dest 0 ' 0 is always visible SCREEN
    _PutImage (0, 0), Screen1, 0 'place first screen as image to visible screen
    _PutImage (1300 / 2, 0), Screen2, 0 'place second screen as imge to visible screen
    _Display
    '_Limit 30
Next boucle%
Print Timer(.001) - start; "seconds"
End
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Coolman - 05-09-2022, 06:58 PM



Users browsing this thread: 19 Guest(s)